Hello Developers,
I’m trying to make county game. Is there any script were you choose a team it reset the player?
Please let me know!
Hello Developers,
I’m trying to make county game. Is there any script were you choose a team it reset the player?
Please let me know!
I’m guessing you’ll want the Team Selection to be done via a GUI? That’ll be up to you to create, but you can do something like this after creating a RemoteEvent for use in the code (using example names, change where applicable):
LocalScript:
Team1Button.MouseButton1Click:Connect(function() --Connect every button like this or via for loop
TeamSwitchEvent:FireServer("Team1") --Fires change event with team info
end)
Serverscript
TeamSwitchEvent.OnServerEvent:Connect(function(Player, Team)
local T = game.Teams:FindFirstChild(Team) --Find team with same name as given
if T ~= nil then
Player.Team = T --Set players Team to found team
Player:LoadCharacter() --Respawn character, if team spawns are set up he'll spawn at the new spawn
end
end)
Ok I’ll try that cause I looked all over youtube for it and I can’t find it so Thank you!