Advertisement
TotallyGames

Script for horror Game

Nov 13th, 2023
918
2
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.89 KB | Gaming | 2 0
  1. Animate:
  2. function   waitForChild(parent, childName)
  3.     local child = parent:findFirstChild(childName)
  4.     if child then return child end
  5.     while true do
  6.         child = parent.ChildAdded:wait()
  7.         if child.Name==childName then return child end
  8.     end
  9. end
  10.  
  11. local Figure = script.Parent
  12. local Humanoid = waitForChild(Figure, "Humanoid")
  13. local pose = "Standing"
  14.  
  15. local currentAnim = ""
  16. local currentAnimInstance = nil
  17. local currentAnimTrack = nil
  18. local currentAnimKeyframeHandler = nil
  19. local currentAnimSpeed = 1.0
  20. local animTable = {}
  21. local animNames = {
  22.     idle =  {  
  23.                 { id = "http://www.roblox.com/asset/?id=507766666", weight = 1 },
  24.                 { id = "http://www.roblox.com/asset/?id=507766951", weight = 1 },
  25.                 { id = "http://www.roblox.com/asset/?id=507766388", weight = 9 }
  26.             },
  27.     walk =  {  
  28.                 { id = "http://www.roblox.com/asset/?id=507777826", weight = 10 }
  29.             },
  30.     run =   {
  31.                 { id = "http://www.roblox.com/asset/?id=507767714", weight = 10 }
  32.             },
  33.     swim =  {
  34.                 { id = "http://www.roblox.com/asset/?id=507784897", weight = 10 }
  35.             },
  36.     swimidle =  {
  37.                 { id = "http://www.roblox.com/asset/?id=507785072", weight = 10 }
  38.             },
  39.     jump =  {
  40.                 { id = "http://www.roblox.com/asset/?id=507765000", weight = 10 }
  41.             },
  42.     fall =  {
  43.                 { id = "http://www.roblox.com/asset/?id=507767968", weight = 10 }
  44.             },
  45.     climb = {
  46.                 { id = "http://www.roblox.com/asset/?id=507765644", weight = 10 }
  47.             },
  48.     sit =   {
  49.                 { id = "http://www.roblox.com/asset/?id=507768133", weight = 10 }
  50.             }, 
  51.     toolnone = {
  52.                 { id = "http://www.roblox.com/asset/?id=507768375", weight = 10 }
  53.             },
  54.     toolslash = {
  55.                 { id = "http://www.roblox.com/asset/?id=507768375", weight = 10 }
  56. --              { id = "slash.xml", weight = 10 }
  57.             },
  58.     toollunge = {
  59.                 { id = "http://www.roblox.com/asset/?id=507768375", weight = 10 }
  60.             },
  61.     wave = {
  62.                 { id = "http://www.roblox.com/asset/?id=507770239", weight = 10 }
  63.             },
  64.     point = {
  65.                 { id = "http://www.roblox.com/asset/?id=507770453", weight = 10 }
  66.             },
  67.     dance = {
  68.                 { id = "http://www.roblox.com/asset/?id=507771019", weight = 10 },
  69.                 { id = "http://www.roblox.com/asset/?id=507771955", weight = 10 },
  70.                 { id = "http://www.roblox.com/asset/?id=507772104", weight = 10 }
  71.             },
  72.     dance2 = {
  73.                 { id = "http://www.roblox.com/asset/?id=507776043", weight = 10 },
  74.                 { id = "http://www.roblox.com/asset/?id=507776720", weight = 10 },
  75.                 { id = "http://www.roblox.com/asset/?id=507776879", weight = 10 }
  76.             },
  77.     dance3 = {
  78.                 { id = "http://www.roblox.com/asset/?id=507777268", weight = 10 },
  79.                 { id = "http://www.roblox.com/asset/?id=507777451", weight = 10 },
  80.                 { id = "http://www.roblox.com/asset/?id=507777623", weight = 10 }
  81.             },
  82.     laugh = {
  83.                 { id = "http://www.roblox.com/asset/?id=507770818", weight = 10 }
  84.             },
  85.     cheer = {
  86.                 { id = "http://www.roblox.com/asset/?id=507770677", weight = 10 }
  87.             },
  88. }
  89.  
  90. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  91. local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
  92.  
  93. math.randomseed(tick())
  94.  
  95. function configureAnimationSet(name, fileList)
  96.     if (animTable[name] ~= nil) then
  97.         for _, connection in pairs(animTable[name].connections) do
  98.             connection:disconnect()
  99.         end
  100.     end
  101.     animTable[name] = {}
  102.     animTable[name].count = 0
  103.     animTable[name].totalWeight = 0
  104.     animTable[name].connections = {}
  105.  
  106.     -- check for config values
  107.     local config = script:FindFirstChild(name)
  108.     if (config ~= nil) then
  109. --      print("Loading anims " .. name)
  110.         table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
  111.         table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
  112.         local idx = 1
  113.         for _, childPart in pairs(config:GetChildren()) do
  114.             if (childPart:IsA("Animation")) then
  115.                 table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
  116.                 animTable[name][idx] = {}
  117.                 animTable[name][idx].anim = childPart
  118.                 local weightObject = childPart:FindFirstChild("Weight")
  119.                 if (weightObject == nil) then
  120.                     animTable[name][idx].weight = 1
  121.                 else
  122.                     animTable[name][idx].weight = weightObject.Value
  123.                 end
  124.                 animTable[name].count = animTable[name].count + 1
  125.                 animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  126. --              print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  127.                 idx = idx + 1
  128.             end
  129.         end
  130.     end
  131.  
  132.     -- fallback to defaults
  133.     if (animTable[name].count <= 0) then
  134.         for idx, anim in pairs(fileList) do
  135.             animTable[name][idx] = {}
  136.             animTable[name][idx].anim = Instance.new("Animation")
  137.             animTable[name][idx].anim.Name = name
  138.             animTable[name][idx].anim.AnimationId = anim.id
  139.             animTable[name][idx].weight = anim.weight
  140.             animTable[name].count = animTable[name].count + 1
  141.             animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  142. --          print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  143.         end
  144.     end
  145. end
  146.  
  147. -- Setup animation objects
  148. function scriptChildModified(child)
  149.     local fileList = animNames[child.Name]
  150.     if (fileList ~= nil) then
  151.         configureAnimationSet(child.Name, fileList)
  152.     end
  153. end
  154.  
  155. script.ChildAdded:connect(scriptChildModified)
  156. script.ChildRemoved:connect(scriptChildModified)
  157.  
  158.  
  159. for name, fileList in pairs(animNames) do
  160.     configureAnimationSet(name, fileList)
  161. end
  162.  
  163. -- ANIMATION
  164.  
  165. -- declarations
  166. local toolAnim = "None"
  167. local toolAnimTime = 0
  168.  
  169. local jumpAnimTime = 0
  170. local jumpAnimDuration = 0.31
  171.  
  172. local toolTransitionTime = 0.1
  173. local fallTransitionTime = 0.2
  174.  
  175. -- functions
  176.  
  177. function stopAllAnimations()
  178.     local oldAnim = currentAnim
  179.  
  180.     -- return to idle if finishing an emote
  181.     if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  182.         oldAnim = "idle"
  183.     end
  184.  
  185.     currentAnim = ""
  186.     currentAnimInstance = nil
  187.     if (currentAnimKeyframeHandler ~= nil) then
  188.         currentAnimKeyframeHandler:disconnect()
  189.     end
  190.  
  191.     if (currentAnimTrack ~= nil) then
  192.         currentAnimTrack:Stop()
  193.         currentAnimTrack:Destroy()
  194.         currentAnimTrack = nil
  195.     end
  196.     return oldAnim
  197. end
  198.  
  199. function setAnimationSpeed(speed)
  200.     if speed ~= currentAnimSpeed then
  201.         currentAnimSpeed = speed
  202.         currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  203.     end
  204. end
  205.  
  206. function keyFrameReachedFunc(frameName)
  207.     if (frameName == "End") then
  208. --      print("Keyframe : ".. frameName)
  209.  
  210.         local repeatAnim = currentAnim
  211.         -- return to idle if finishing an emote
  212.         if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
  213.             repeatAnim = "idle"
  214.         end
  215.        
  216.         local animSpeed = currentAnimSpeed
  217.         playAnimation(repeatAnim, 0.15, Humanoid)
  218.         setAnimationSpeed(animSpeed)
  219.     end
  220. end
  221.  
  222. -- Preload animations
  223. function playAnimation(animName, transitionTime, humanoid)
  224.        
  225.     local roll = math.random(1, animTable[animName].totalWeight)
  226.     local origRoll = roll
  227.     local idx = 1
  228.     while (roll > animTable[animName][idx].weight) do
  229.         roll = roll - animTable[animName][idx].weight
  230.         idx = idx + 1
  231.     end
  232.    
  233. --  print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  234.    
  235.     local anim = animTable[animName][idx].anim
  236.  
  237.     -- switch animation    
  238.     if (anim ~= currentAnimInstance) then
  239.        
  240.         if (currentAnimTrack ~= nil) then
  241.             currentAnimTrack:Stop(transitionTime)
  242.             currentAnimTrack:Destroy()
  243.         end
  244.  
  245.         currentAnimSpeed = 1.0
  246.    
  247.         -- load it to the humanoid; get AnimationTrack
  248.         currentAnimTrack = humanoid:LoadAnimation(anim)
  249.          
  250.         -- play the animation
  251.         currentAnimTrack:Play(transitionTime)
  252.         currentAnim = animName
  253.         currentAnimInstance = anim
  254.  
  255.         -- set up keyframe name triggers
  256.         if (currentAnimKeyframeHandler ~= nil) then
  257.             currentAnimKeyframeHandler:disconnect()
  258.         end
  259.         currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  260.        
  261.     end
  262.  
  263. end
  264.  
  265. -------------------------------------------------------------------------------------------
  266. -------------------------------------------------------------------------------------------
  267.  
  268. local toolAnimName = ""
  269. local toolAnimTrack = nil
  270. local toolAnimInstance = nil
  271. local currentToolAnimKeyframeHandler = nil
  272.  
  273. function toolKeyFrameReachedFunc(frameName)
  274.     if (frameName == "End") then
  275. --      print("Keyframe : ".. frameName)   
  276.         playToolAnimation(toolAnimName, 0.0, Humanoid)
  277.     end
  278. end
  279.  
  280.  
  281. function playToolAnimation(animName, transitionTime, humanoid)   
  282.        
  283.         local roll = math.random(1, animTable[animName].totalWeight)
  284.         local origRoll = roll
  285.         local idx = 1
  286.         while (roll > animTable[animName][idx].weight) do
  287.             roll = roll - animTable[animName][idx].weight
  288.             idx = idx + 1
  289.         end
  290. --      print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  291.         local anim = animTable[animName][idx].anim
  292.  
  293.         if (toolAnimInstance ~= anim) then
  294.            
  295.             if (toolAnimTrack ~= nil) then
  296.                 toolAnimTrack:Stop()
  297.                 toolAnimTrack:Destroy()
  298.                 transitionTime = 0
  299.             end
  300.                    
  301.             -- load it to the humanoid; get AnimationTrack
  302.             toolAnimTrack = humanoid:LoadAnimation(anim)
  303.              
  304.             -- play the animation
  305.             toolAnimTrack:Play(transitionTime)
  306.             toolAnimName = animName
  307.             toolAnimInstance = anim
  308.  
  309.             currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  310.         end
  311. end
  312.  
  313. function stopToolAnimations()
  314.     local oldAnim = toolAnimName
  315.  
  316.     if (currentToolAnimKeyframeHandler ~= nil) then
  317.         currentToolAnimKeyframeHandler:disconnect()
  318.     end
  319.  
  320.     toolAnimName = ""
  321.     toolAnimInstance = nil
  322.     if (toolAnimTrack ~= nil) then
  323.         toolAnimTrack:Stop()
  324.         toolAnimTrack:Destroy()
  325.         toolAnimTrack = nil
  326.     end
  327.  
  328.  
  329.     return oldAnim
  330. end
  331.  
  332. -------------------------------------------------------------------------------------------
  333. -------------------------------------------------------------------------------------------
  334.  
  335.  
  336. function onRunning(speed)
  337.     if speed > 0.01 then
  338.         local scale = 15.0
  339.         playAnimation("walk", 0.1, Humanoid)
  340.         setAnimationSpeed(speed / scale)
  341.         pose = "Running"
  342.     else
  343.         playAnimation("idle", 0.1, Humanoid)
  344.         pose = "Standing"
  345.     end
  346. end
  347.  
  348. function onDied()
  349.     pose = "Dead"
  350. end
  351.  
  352. function onJumping()
  353.     playAnimation("jump", 0.1, Humanoid)
  354.     jumpAnimTime = jumpAnimDuration
  355.     pose = "Jumping"
  356. end
  357.  
  358. function onClimbing(speed)
  359.     local scale = 5.0
  360.     playAnimation("climb", 0.1, Humanoid)
  361.     setAnimationSpeed(speed / scale)
  362.     pose = "Climbing"
  363. end
  364.  
  365. function onGettingUp()
  366.     pose = "GettingUp"
  367. end
  368.  
  369. function onFreeFall()
  370.     if (jumpAnimTime <= 0) then
  371.         playAnimation("fall", fallTransitionTime, Humanoid)
  372.     end
  373.     pose = "FreeFall"
  374. end
  375.  
  376. function onFallingDown()
  377.     pose = "FallingDown"
  378. end
  379.  
  380. function onSeated()
  381.     pose = "Seated"
  382. end
  383.  
  384. function onPlatformStanding()
  385.     pose = "PlatformStanding"
  386. end
  387.  
  388. function onSwimming(speed)
  389.     if speed > 1.00 then
  390.         local scale = 10.0
  391.         playAnimation("swim", 0.4, Humanoid)
  392.         setAnimationSpeed(speed / scale)
  393.         pose = "Swimming"
  394.     else
  395.         playAnimation("swimidle", 0.4, Humanoid)
  396.         pose = "Standing"
  397.     end
  398. end
  399.  
  400. function getTool() 
  401.     for _, kid in ipairs(Figure:GetChildren()) do
  402.         if kid.className == "Tool" then return kid end
  403.     end
  404.     return nil
  405. end
  406.  
  407. function getToolAnim(tool)
  408.     for _, c in ipairs(tool:GetChildren()) do
  409.         if c.Name == "toolanim" and c.className == "StringValue" then
  410.             return c
  411.         end
  412.     end
  413.     return nil
  414. end
  415.  
  416. function animateTool()
  417.    
  418.     if (toolAnim == "None") then
  419.         playToolAnimation("toolnone", toolTransitionTime, Humanoid)
  420.         return
  421.     end
  422.  
  423.     if (toolAnim == "Slash") then
  424.         playToolAnimation("toolslash", 0, Humanoid)
  425.         return
  426.     end
  427.  
  428.     if (toolAnim == "Lunge") then
  429.         playToolAnimation("toollunge", 0, Humanoid)
  430.         return
  431.     end
  432. end
  433.  
  434. function moveSit()
  435.     RightShoulder.MaxVelocity = 0.15
  436.     LeftShoulder.MaxVelocity = 0.15
  437.     RightShoulder:SetDesiredAngle(3.14 /2)
  438.     LeftShoulder:SetDesiredAngle(-3.14 /2)
  439.     RightHip:SetDesiredAngle(3.14 /2)
  440.     LeftHip:SetDesiredAngle(-3.14 /2)
  441. end
  442.  
  443. local lastTick = 0
  444.  
  445. function move(time)
  446.     local amplitude = 1
  447.     local frequency = 1
  448.     local deltaTime = time - lastTick
  449.     lastTick = time
  450.  
  451.     local climbFudge = 0
  452.     local setAngles = false
  453.  
  454.     if (jumpAnimTime > 0) then
  455.         jumpAnimTime = jumpAnimTime - deltaTime
  456.     end
  457.  
  458.     if (pose == "FreeFall" and jumpAnimTime <= 0) then
  459.         playAnimation("fall", fallTransitionTime, Humanoid)
  460.     elseif (pose == "Seated") then
  461.         playAnimation("sit", 0.5, Humanoid)
  462.         return
  463.     elseif (pose == "Running") then
  464.         playAnimation("walk", 0.1, Humanoid)
  465.     elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  466.         stopAllAnimations()
  467.         amplitude = 0.1
  468.         frequency = 1
  469.         setAngles = true
  470.     end
  471.  
  472.     -- Tool Animation handling
  473.     local tool = getTool()
  474.     if tool then
  475.    
  476.         animStringValueObject = getToolAnim(tool)
  477.  
  478.         if animStringValueObject then
  479.             toolAnim = animStringValueObject.Value
  480.             -- message recieved, delete StringValue
  481.             animStringValueObject.Parent = nil
  482.             toolAnimTime = time + .3
  483.         end
  484.  
  485.         if time > toolAnimTime then
  486.             toolAnimTime = 0
  487.             toolAnim = "None"
  488.         end
  489.  
  490.         animateTool()      
  491.     else
  492.         stopToolAnimations()
  493.         toolAnim = "None"
  494.         toolAnimInstance = nil
  495.         toolAnimTime = 0
  496.     end
  497. end
  498.  
  499. -- connect events
  500. Humanoid.Died:connect(onDied)
  501. Humanoid.Running:connect(onRunning)
  502. Humanoid.Jumping:connect(onJumping)
  503. Humanoid.Climbing:connect(onClimbing)
  504. Humanoid.GettingUp:connect(onGettingUp)
  505. Humanoid.FreeFalling:connect(onFreeFall)
  506. Humanoid.FallingDown:connect(onFallingDown)
  507. Humanoid.Seated:connect(onSeated)
  508. Humanoid.PlatformStanding:connect(onPlatformStanding)
  509. Humanoid.Swimming:connect(onSwimming)
  510.  
  511. -- setup emote chat hook
  512. script.msg.Changed:connect(function(msg)
  513.     script.msg.Value = ""
  514.     local emote = ""
  515.     if (string.sub(msg, 1, 3) == "/e ") then
  516.         emote = string.sub(msg, 4)
  517.     elseif (string.sub(msg, 1, 7) == "/emote ") then
  518.         emote = string.sub(msg, 8)
  519.     end
  520.    
  521.     if (pose == "Standing" and emoteNames[emote] ~= nil) then
  522.         playAnimation(emote, 0.1, Humanoid)
  523.     end
  524. --  print("===> " .. string.sub(msg, 1, 3) .. "(" .. emote .. ")")
  525. end)
  526.  
  527.  
  528. -- main program
  529.  
  530. local runService = game:service("RunService");
  531.  
  532. -- print("bottom")
  533.  
  534. -- initialize to idle
  535. playAnimation("idle", 0.1, Humanoid)
  536. pose = "Standing"
  537.  
  538. while Figure.Parent~=nil do
  539.     local _, time = wait(0.1)
  540.     move(time)
  541. end
  542.  
  543.  
  544.  
  545.  
  546.  
  547. Follow:
  548.  
  549.  
  550.  
  551.  
  552.  
  553. local larm = script.Parent:FindFirstChild("HumanoidRootPart")
  554. local rarm = script.Parent:FindFirstChild("HumanoidRootPart")
  555.  
  556. function findNearestTorso(pos)
  557.     local list = game.Workspace:children()
  558.     local torso = nil
  559.     local dist = math.huge
  560.     local temp = nil
  561.     local human = nil
  562.     local temp2 = nil
  563.     for x = 1, #list do
  564.         temp2 = list[x]
  565.         if (temp2.className == "Model") and (temp2 ~= script.Parent) then
  566.             temp = temp2:findFirstChild("HumanoidRootPart")
  567.             human = temp2:findFirstChild("Humanoid")
  568.             if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
  569.                 if (temp.Position - pos).magnitude < dist then
  570.                     torso = temp
  571.                     dist = (temp.Position - pos).magnitude
  572.                 end
  573.             end
  574.         end
  575.     end
  576.     return torso
  577. end
  578.  
  579.  
  580.  
  581.  
  582. while true do
  583.     wait(0)
  584.     local target = findNearestTorso(script.Parent.HumanoidRootPart.Position)
  585.     if target ~= nil then
  586.         script.Parent.Humanoid:MoveTo(target.Position, target)
  587.     end
  588.  
  589. end
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596. Damage:
  597.  
  598.  
  599.  
  600.  
  601.  
  602. function onTouched(hit)
  603.         local human = hit.Parent:findFirstChild("Humanoid")
  604.         if (human ~= nil) then
  605.                 human.Health = human.Health - 20
  606.         end
  607. end
  608. script.Parent.Touched:connect(onTouched)
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615. FlashLight: (для фонарика)
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623. script.Parent.Activated:Connect(function()
  624.     if script.Parent.Handle.SpotLight.Enabled == true then
  625.         script.Parent.Handle.SpotLight.Enabled = false
  626.         script.Parent.Handle.Sound:Play()
  627.     else
  628.         script.Parent.Handle.SpotLight.Enabled = true
  629.         script.Parent.Handle.Sound:Play()  --вместо Sound название вашего звука
  630.     end
  631. end)
  632. script.Parent.Equipped:Connect(function()
  633.     script.Parent.Handle.SpotLight.Enabled = false
  634.     script.Parent.Handle.equip:Play()
  635. end)
  636. script.Parent.Unequipped:Connect(function()
  637.     script.Parent.Handle.equip:Play()
  638. end)
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647. Shift To run:
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655. local Player = game.Players.LocalPlayer
  656.     local Character = workspace:WaitForChild(Player.Name)
  657.         local Humanoid = Character:WaitForChild('Humanoid')
  658.        
  659. local RunAnimation = Instance.new('Animation')
  660. RunAnimation.AnimationId = 'rbxassetid://1721906652'
  661. RAnimation = Humanoid:LoadAnimation(RunAnimation)
  662.  
  663. Running = false
  664.  
  665. function Handler(BindName, InputState)
  666.     if InputState == Enum.UserInputState.Begin and BindName == 'RunBind' then
  667.         Running = true
  668.         Humanoid.WalkSpeed = 50
  669.     elseif InputState == Enum.UserInputState.End and BindName == 'RunBind' then
  670.         Running = false
  671.         if RAnimation.IsPlaying then
  672.             RAnimation:Stop()
  673.         end
  674.         Humanoid.WalkSpeed = 16
  675.     end
  676. end
  677.  
  678. Humanoid.Running:connect(function(Speed)
  679.     if Speed >= 10 and Running and not RAnimation.IsPlaying then
  680.         RAnimation:Play()
  681.         Humanoid.WalkSpeed = 50
  682.     elseif Speed >= 10 and not Running and RAnimation.IsPlaying then
  683.         RAnimation:Stop()
  684.         Humanoid.WalkSpeed = 16
  685.     elseif Speed < 10 and RAnimation.IsPlaying then
  686.         RAnimation:Stop()
  687.         Humanoid.WalkSpeed = 16
  688.     end
  689. end)
  690.  
  691. Humanoid.Changed:connect(function()
  692.     if Humanoid.Jump and RAnimation.IsPlaying then
  693.         RAnimation:Stop()
  694.     end
  695. end)
  696.  
  697. game:GetService('ContextActionService'):BindAction('RunBind', Handler, true, Enum.KeyCode.LeftShift)
  698.  
  699.  
  700.  
  701. Part1 Script:
  702.  
  703.  
  704. local part1 = script.Parent
  705. local part2 = workspace.Part2 --если вы назвали парт не Part2 а как то по своему то вместо workspace.Part2 пишите workspace.название парта
  706.  
  707.  
  708. local function onTouch(hit)
  709.    
  710.     local character = hit.Parent
  711.     if character:IsA("Model") and character:FindFirstChild("Humanoid") then
  712.        
  713.         part2.CanCollide = false
  714.     end
  715. end
  716.  
  717.  
  718. part1.Touched:Connect(onTouch)
  719.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement