I have a script ive used for GUIs that only shows on your screen if your in the group, how can I make it so that it makes a part visible on your player if your in the group? (The part loads onto the body automatically which works I just want it to be made visible if your in the group)
local player = game.Players.LocalPlayer local groupId = 609409 while true do if player:IsInGroup(groupId) then script.Parent.SurfaceGui.Enabled = true end end
Your biggest issue is the creation of an infinite loop with no delays which will crash a game/studio. An easy fix is adding a wait somewhere within the code.
local player = game.Players.LocalPlayer local groupId = 609409 while true do if player:IsInGroup(groupId) then script.Parent.SurfaceGui.Enabled = true break -- stop this loop, no purpose at this point end wait(1) -- wait 1 second end
You are using a local script, the only person that may see this change is the script owner!