Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Teleporting block ?

Hey i am new to scripting and i try to make a block(part ) to follow you just a little bit behind like 5 studs but i cant figure it out in anyway.

function onPlayerEntered(player) player.CharacterAdded:connect(function(char) while wait() do script.Parent.CFrame = CFrame.new(char.Torso.Position) end end) end

game.Players.PlayerAdded:connect(onPlayerEntered)

1 answer

✓ Accepted answer
game.Players.PlayerAdded:connect(function(player)
local torso = player.Character.Torso
if torso then
torso.CFrame = CFrame.new(torso.Position.x-5,torso.Position.y,torso.Position.z) --or something
end
end)

Please put it in a code block next time.

1 comment

0

Sorry for the code block thing but youre code wont work it gives me the error 20:14:40.101 - Workspace.Part1.Script:2: attempt to index field 'Character' (a nil value)

This discussion is preserved as it was. New answers, comments, and votes are closed.