So I basically want to make it so that if a player is on a certain team (In this instance the team is called "Staff") then This Text Button should be visible for them.
if game.Players.LocalPlayer.Team.Name == "Staff" then local player = game.Players.LocalPlayer player:WaitForChild("PlayerGui").ScreenGui.Spawn.Disable.Visible = true end
I have no idea if this works under filtering enabled but when I tried "Play Solo" in studio it didn't work either Add me on discord if you don't get the question 3ptWRLD#8788
LocalScript
game.Players.LocalPlayer:GetPropertyChangedSignal("TeamColor"):Connect(function() if game.Players.LocalPlayer.TeamColor = BrickColor.new("TEAMCOLOR") then game.Players.LocalPlayer.GUI.FRAME.Visible = true -- Set to make your gui visible. end end)
Edit: Above script won't work. Use below instead
Server Script
game.Players.PlayerAdded:Connect(function(player) player.Changed:Connect(function(property) if property == "TeamColor" then if player.TeamColor == BrickColor.new("COLOR") then end end end) end)
Try this:
Make sure the script is not in startergui but instead, server storage
while wait() do for _, v in pairs(game.Players:GetChildren()) do if v:FindFirstChild("Staff") then v.PlayerGui.ScreenGui.Spawn.Disable.Visible = true end end end
Oh and by the way, sometimes your code glitches if you have properties as variables..
You can try this LOCAL script. Make sure to put it inside StarterGui.
local Player = game.Player.LocalPlayer TeamName = "Staff" game.Players.PlayerAdded:Connect(function() if Player.Team.Name == TeamName then local GUI = Player.PlayerGui:WaitForChild("ScreenGui") GUI.Spawn.Disable.Visible = true end end)
Hope that this works