Okay, so recently I have been trying to make an advanced team gui that you could easily configure in a module script. The strange thing is it does everything perfectly it just doesn’t actually team the player. I tried debugging it with print but I didn’t get any errors/nil values, nor did I get any errors in general in the output. There are 3 different scripts connected, one being the Local Script, Server Script and Module Script. I will list all of them down below. Any and all help is appreciated so thank you in advance!
Local Script:
local player = game:GetService("Players").LocalPlayer
local replicatedstorage = game:GetService("ReplicatedStorage")
local teammodule = require(replicatedstorage:WaitForChild("ModuleScript"))
local switchteam = replicatedstorage:WaitForChild("SwitchTeam")
local teamlist = script.Parent:WaitForChild("TeamList")
local avaliableteams = teamlist:GetChildren()
for a = 1,#avaliableteams do
if avaliableteams[a].ClassName == "TextButton" then
if player:IsInGroup(avaliableteams[a].Name) then
else
avaliableteams[a]:Destroy()
end
avaliableteams[a].MouseButton1Down:Connect(function(changeteam)
print("Working")
for i,v in pairs(teammodule) do
print(v)
if avaliableteams[a].Name == i then
print("Avaliable Team")
switchteam:FireServer(v[2],v[1])
print("Fired")
end
end
end)
end
end
Server Script:
local plr = game:GetService("Players").LocalPlayer
local teams = game:GetService("Teams")
local replicatedstorage = game:GetService("ReplicatedStorage")
local switchteam = replicatedstorage:WaitForChild("SwitchTeam")
function changeteam(player,teamcolor,groupid)
if player:IsInGroup(groupid) then
if player.TeamColor ~= teamcolor then
print("Event fired")
player.TeamColor = BrickColor.new(teamcolor)
print(teamcolor)
player:LoadCharacter()
end
end
end
switchteam.OnServerEvent:Connect(changeteam)
Module Script:
local module = {
["5131370"] = {5131370,"Deep orange"},
["262619"] = {262619,"Really black"},
["5996731"] = {5996731,"Dark stone grey"}
}
return module