Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Teleporting block ?

Asked by
Kryddan 261 Moderation Voter
9 years ago

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

Log in to vote
0
Answered by 9 years ago
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.

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) Kryddan 261 — 9y
Ad

Answer this question