So this is the whole script : ~~~~~~~~~~~~~~~~~
local Player = game.Players.LocalPlayer
for i,v in pairs(script.Parent.MainFrame.ScrollingFrame:GetChildren()) do
if v:IsA("TextButton") then
v.MouseButton1Click:Connect(function()
if v:FindFirstChild("Group Settings") then
if Player:GetRankInGroup(v["Group Settings"].GroupId.Value) < v["Group Settings"].MinRank.Value then
return
end
end
if game:FindFirstChild("Teams") == nil then
ErrorMsg("ERROR: You haven't inserted any teams in your game.")
elseif game.Teams:FindFirstChild(v.Text) == nil then
ErrorMsg("ERROR: The text of the button must be the same as the team name.")
else
game.ReplicatedStorage.TeamChanger:FireServer(v.Text)
end
end)
end
end
function ErrorMsg(Msg)
local M = Instance.new("Message")
M.Text = Msg
M.Parent = game.Workspace
game.Debris:AddItem(M, 5)
end
So this is the script far.There is one more script for this.
local TC = Instance.new("RemoteEvent")
TC.Name = "TeamChanger"
TC.Parent = game.ReplicatedStorage
TC.OnServerEvent:Connect(function(Player, TeamName)
Player.Team = game.Teams[TeamName]
Player:LoadCharacter()
end)
Now some of the script dont get in the Lua Block but i dont know what to do with it.

4 comments
Please edit that to make all of the script in the same format. I'm having a hard time reading it.
might be because you never used WaitForChild(event) on the client.
might be because you never used WaitForChild(event) on the client.
it cannot be localscript OOF