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

Why doesnt this teleportation chat script work anymore?

local player = game.Players.LocalPlayer

local remoteEvent = game.ReplicatedStorage:WaitForChild("playertp")

player.Chatted:Connect(function(msg)

if msg:lower():match("tp") then

if game.Players:FindFirstChild(msg:sub(4)) then

local target = game.Players:FindFirstChild(msg:sub(4))

print(target.Name)

player.Character.HumanoidRootPart.CFrame = CFrame.new(target.Character.Head.Position)

end

end

end)

nothing printed and no errors, none of my teleportation chat commands work anymore but why. and yes this is a local script

3 comments

0

just wondering, whats the point of having a remoteEvent, if you never use it in the script

1

Chat should be managed from the server

0

i use the remoteevent, i just didnt show what it does in this script but its there and chat has worked before from the client

1 answer

local player = game.Players.LocalPlayer

player.Chatted:Connect(function(msg)

if msg:sub(1,2):lower():match("tp") then

print(msg:sub(3)) if game.Players:FindFirstChild(msg:sub(4)) then

local target = game.Players:FindFirstChild(msg:sub(4))

print(target.Name)

player.Character.HumanoidRootPart.CFrame = CFrame.new(target.Character.Head.Position)

end

end

end) You messed something up.

3 comments

0

no i didnt

0

this is no difference to what i did in my script

0

For ME it worked

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