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

Teleport user on saying certain word?

Hi! I have this script, but it's not working for some reason. It's supposed to teleport the player to a certain point once they say a certain word.

local word = "word" --Here's where I'd put the word.
local plrs = game:GetService("Players")

local brick = path --pathway to the brick I want to tp them to.

plrs.PlayerAdded:Connect(function(plr)
    plr.Chatted:Connect(function(msg)
        msg = msg:lower() 

        if msg == word then
            plr.Character.HumanoidRootPart.CFrame = brick.CFrame
        end
    end)
end)

1 answer

✓ Accepted answer

Your script actually works, but you've made a small mistake.

I'm guessing when you're assigning the 'brick' variable you're putting a cframe position And when you're teleporting to 'brick.CFrame' it's like you're saying CFrame.CFrame. Don't be deceived by the variable's name, lol.

So just remove the 'brick' from plr.Character.HumanoidRootPart.CFrame = brick.CFrame And you should be good.

Example, just incase:

local word = "word"
local plrs = game:GetService("Players")

local brick = CFrame.new(100,100,100)

plrs.PlayerAdded:Connect(function(plr)
    plr.Chatted:Connect(function(msg)
        msg = msg:lower() 

        if msg == word then
            plr.Character.HumanoidRootPart.CFrame = brick
        end
    end)
end)

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