Hi guys.

Okay, so this is like my third time ever using a localscript, and I'm already confused.

I made this Menu screen which pops up when you respawn, and gives you options like "Play", "Switch team", etc etc.

The idea is that when you press one of the teams, you respawn your character and switch teams. For this I used the following code:

local player = game.Players.LocalPlayer
local groupID = removedIDforPrivacy
local button = script.Parent
local gui = script.Parent.Parent.Parent

script.Parent.MouseButton1Click:connect(function()
	if player:GetRankInGroup(groupID) == 70 or player:GetRankInGroup(groupID) == 71  then
		button.Text = "Teamed!"
		player.TeamColor = BrickColor.new("Bright yellow")
		wait(1.5)
		gui:Destroy()
		wait(0.3)
		player:LoadCharacter()
	else
		button.Text = "Error!"
		wait(1.5)
		button.Text = "Guardians"
	end
end)

Some might've already realized what's going wrong here, and I THINK I know it aswell, but I wouldn't know a solution.

I asked my friends to help me test this, and when they press the team, it teams them on their screen, but for me they'll stay on the default team. The respawn ("LoadCharacter") function isn't working either. The GUI just destroys itself but their character stays alive.

Any solutions?!

2 comments

0

Solid guess that FE is enabled, you will need to use a remote event on everything after the "Teamed!" line other than the gui destroying http://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events

0

Yep you're right. I figured it out after a while aswell. I never understood those RemoteEvents but now I'm using it, and I realize it's great! Appreciate it