✓ Accepted answer
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:
humanoid.Walkspeed = 0
humanoid.JumpPower = 0
wait(1)
and this after:
wait(1)
humanoid.Walkspeed = 16
humanoid.JumpPower = 50
This'll wait for one second before TPing the player and it'll freeze the player for 2 seconds.
Final Script
local Hit = game.Workspace.Model.Hit
local L1 = game.Workspace.Model.L1
local End = game.Workspace.Model.End
function onTouched(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local character = hit.Parent
local humanoid = character:WaitForChild("Humanoid")
humanoid.Walkspeed = 0
humanoid.JumpPower = 0
wait(1)
humanoid:MoveTo(L1.Position)
wait(1)
humanoid.Walkspeed = 16
humanoid.JumpPower = 50
end
end
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:
local Hit = workspace.Model.Hit
local L1 = workspace.Model.L1
local End = workspace.Model.End
function onTouched(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local character = hit.Parent
local torso = character.Torso
local humanoid = character:WaitForChild("Humanoid")
humanoid.Walkspeed = 0
humanoid.JumpPower = 0
wait(1)
torso.CFrame = CFrame.new(L1.Position)
wait(1)
humanoid.Walkspeed = 16
humanoid.JumpPower = 50
end
end
script.Parent.Touched:connect(onTouched)
If this helped you, be sure to accept my answer! It helps both of us!
2 comments
Just change the humanoid state http://wiki.roblox.com/index.php?title=API:Enum/HumanoidStateType to http://wiki.roblox.com/index.php?title=API:Class/Humanoid/PlatformStand
so humanoid.PlatformStand = true