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

Got a script that needs fixing for my group help?

So whenever we are raided the raider limit is broken so if they get 20 people then lose 5 they can't get another 5 people in. It stays stuck at 20 we only have 2 massive scripts at the fort but this is the portion of the raider limit script. All the variables and stuff are done correctly but here it is How do I fix this?

local Team = PlayerTeam(Player,1)
if Team == "Fallen" then 
	Player.TeamColor = Fallen[1] 
	Fallen_Count.Value = Fallen_Count.Value + 1 
	Group.Value = true
else 
	if Raider_Count.Value < 20 then
		Player.TeamColor = Raider[1]
		Raider_Count.Value = Raider_Count.Value + 1 
	else
		Player:Kick("FALLEN ALERT: KICKED DUE TO RAIDER OVERLOAD")
	end
end

1 comment

0

To put into better terms when there's 20 raiders and for example say one leaves the script will still think there's 20 raiders.

1 answer

game.Players.PlayerRemoving:connect(function(player)
	if Team == "Raider" then
		Raider_Count.Value = Raider_Count - 1
	end
end)

Should work. Unless i messed up the PlayerRemoving part.

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