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

Message function called :rejoin doesn't work?

So I put this script in workspace and it's an local script. But for some reason this does nothing. The Developer Console doesn't print anything? And it doesn't let the player rejoin. Please help me. Local Script:

while true do
	wait(0.01)
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)  
local playerSaidRejoin = message:lower() == ":rejoin" 
if playerSaidRejoin then
				player.PlayerGui.RejoinMessage.Frame.Visible = true
			print("Rejoingui set true")
						print("Teleporting...")
game:GetService("TeleportService"):Teleport(game.PlaceId)
						print("Teleported.")
end
		end)
	end)
	end

Thanks for looking and trying to help me c:

1 answer

✓ Accepted answer

Local scripts won't run in the workspace, you will have to place this script inside of PlayerGui,StarterPack or StarterPlayerScripts. This is how the script should look like:

local Player = game.Players.LocalPlayer

Player.Chatted:Connect(function(message)  
	if message:lower() == ":rejoin" then
		Player.PlayerGui.RejoinMessage.Frame.Visible = true
		game:GetService("TeleportService"):Teleport(game.PlaceId)                     
	end
end)

Note: I didn't have much time to explain in case something is unclear comment and I will help you!

1 comment

0

Omg thank you! Accepted c:

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