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

How do I make this Script only Functional for a Group?

local Player = script.Parent.Parent.Parent.Parent.Parent
local teamcolor = "Bright green"

function onClick()
	if Player.TeamColor == BrickColor.new(teamcolor) then
	return
	else
	Player.TeamColor = BrickColor.new(teamcolor)
	Player.Character.Humanoid.Health = 0
	end
end

script.Parent.MouseButton1Down:connect(onClick)

1 answer

✓ Accepted answer
local Player = script.Parent.Parent.Parent.Parent.Parent -- I'm guessing this isn't a localscript, but if it is I would use game.Players.LocalPlayer
local teamcolor = "Bright green"
local groupID = 0 -- put the group ID here
function onClick()
    if Player.TeamColor == BrickColor.new(teamcolor) and Player:IsInGroup(groupID) then
    return
    else
    Player.TeamColor = BrickColor.new(teamcolor)
    Player.Character.Humanoid.Health = 0
    end
end

script.Parent.MouseButton1Down:connect(onClick)

#Player:IsInGroup()

let me write a little explanation on this wonder. Well, there's nothing to explain, but it checks if the Player is in the group ID put in the parameters.

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