Hello,
I have a script, that makes you stick to a part for 2 seconds However, if you've done it once, it stops working And if it's used on a moving object, you don't stick to the object anymore I don't get any errors however
Help me please
game.Players.PlayerAdded:Connect(function(p) local char = game.Workspace:WaitForChild(p.Name) local part = script.Parent -- part local time = 2 -- amount of time local place = CFrame.new(part.Position) -- Where you want the player to go on touched repeat wait(1) time = time - 1 char.Torso.CFrame = place until time < 1 end)
If you could help, thanks
+I'm really bad with scripts that are activated on touch of script.parent so how do I do that?
This isn't an impossible task to do. All you have to do is: Instead of putting
char.Torso.CFrame = place
,
try
char.Torso.CFrame = CFrame.new(part.Position)
so it's going to get the new CFrame of the part every second.
game.Players.PlayerAdded:Connect(function(p) local char = game.Workspace:WaitForChild(p.Name) local part = script.Parent -- part local time = 2 -- amount of time repeat wait(1) time = time - 1 char.Torso.CFrame = CFrame.new(part.Position) until time < 1 end)