Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Trying to make part visible on your body , if you are in a group, cant get script to work?

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

1 answer

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!

2 comments

0

How do I make it a Server Side script?

0

Sorry for the slow response. A server side script is the element in studio called "script". You cannot grab player via game.Players.LocalPlayer using one

This discussion is preserved as it was. New answers, comments, and votes are closed.