Basically, I have a text button that players can click to make a new team with their name on it. Then I want a gui to display that has a textbutton with the teams name that all clients can see. The script makes the team, but the gui doesn't display. I am not getting any errors, but the gui won't display. I am admittedly horrible with guis. Any help would be greatly appreciated.
local RS = game:GetService("ReplicatedStorage") local Teamevent = RS:FindFirstChild("Teams") Teamevent.OnServerEvent:Connect(function(player) local team = Instance.new("Team") team.Name = player.Name team.Parent = game.Teams for i,v in pairs (game.Players:GetChildren()) do local plr = v local name = v.Name local teamgui = Instance.new("ScreenGui", game.Players.name.PlayerGui) teamgui.Enabled = true local frame = Instance.new("Frame") frame.Parent = teamgui frame.Size = UDim2.new(0.5, 0, .5, 0) frame.Position = UDim2.new(.25,0,.25,0) frame.Visible = true local ui = Instance.new("UIListLayout") ui.Parent = frame local textButton = RS:FindFirstChild("Sample") textButton.Parent = frame textButton.Text = team.Name end end)
I'm not great at scripting but line 11?
local teamgui = Instance.new("ScreenGui", game:GetService("players"):FindFirstChild(name).PlayerGui)
You were just getting game.players.name before which will return "players" (the name of the service, not your variable)
Hopefully this helps??