I'm using a script in server script storage that is meant to teleport a player to a separate place when they say a keyword in chat but when I test it (in Roblox, not studio) it never works. When I test it in the studio it says "Teleport Invalid", can someone please tell me how to fix this?
local TeleportService = game:GetService("TeleportService") TeleportService:Teleport(gameid) game.Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(msg) if msg == "Yessir" then game:GetService('TeleportService'):Teleport(GameID) end end) end)
you have to put the player variable in like this :
local TeleportService = game:GetService("TeleportService") TeleportService:Teleport(gameid) game.Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(msg) if msg == "Yessir" then game:GetService('TeleportService'):Teleport(GameID,player) end end) end)