Answered by
8 years ago Edited 8 years ago
Problem
You want to disable the character's movement abilities until it's done
Solution
A humanoid has the option in the properties bar to change movement and such. Add this to the script:
and this after:
This'll wait for one second before TPing the player and it'll freeze the player for 2 seconds.
Final Script
01 | local Hit = game.Workspace.Model.Hit |
02 | local L 1 = game.Workspace.Model.L 1 |
03 | local End = game.Workspace.Model.End |
05 | function onTouched(hit) |
06 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
07 | local character = hit.Parent |
08 | local humanoid = character:WaitForChild( "Humanoid" ) |
09 | humanoid.Walkspeed = 0 |
10 | humanoid.JumpPower = 0 |
12 | humanoid:MoveTo(L 1. Position) |
14 | humanoid.Walkspeed = 16 |
15 | humanoid.JumpPower = 50 |
19 | script.Parent.Touched:connect(onTouched) |
Suggestions
I recommend using CFrames rather than humanoid:MoveTo
, and also changing game.Workspace to simply "workspace". With following these suggestions, THIS would be the final script:
01 | local Hit = workspace.Model.Hit |
02 | local L 1 = workspace.Model.L 1 |
03 | local End = workspace.Model.End |
05 | function onTouched(hit) |
06 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
07 | local character = hit.Parent |
08 | local torso = character.Torso |
09 | local humanoid = character:WaitForChild( "Humanoid" ) |
10 | humanoid.Walkspeed = 0 |
11 | humanoid.JumpPower = 0 |
13 | torso.CFrame = CFrame.new(L 1. Position) |
15 | humanoid.Walkspeed = 16 |
16 | humanoid.JumpPower = 50 |
20 | script.Parent.Touched:connect(onTouched) |
If this helped you, be sure to accept my answer! It helps both of us!
Locked by youtubemasterWOW and zblox164
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?