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

Teleport user on saying certain word? [closed]

Asked by 5 years ago

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)

Closed as Non-Descriptive by hiimgoodpack and BlackOrange3343

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 5 years ago

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)

Ad