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

How can I make this button script work for a group rank only?

Here is the script

script.Parent.MouseButton1Click:connect(function(GetCar)
		Mod = game.ServerStorage.test    --Change test to whatever you have named the item you want to spawn
		clone = Mod:clone()
		clone.Parent = workspace
		clone:MakeJoints()
end)

1 answer

You can achieve this by using the GetRankInGroup function of Player.

local Player = game:GetService("Players").LocalPlayer

local Button = script.Parent

local GroupId = --// Enter Group Id
local GroupRankMargin = --// Rank Priority # (1-255; 255 as owner)

Button.MouseButton1Click:Connect(function()
if (Player:GetRankInGroup(GroupId) >= GroupRankMargin) then
		--// Code
	end
end)

Remember to accept this answer if it helps!

6 comments

0

Is that a local script?

0

The script remains the same, Local. You cannot call MouseButton1Click from a Server Script, nor retrieve the Local Client

0

I did this

0

It doesn't work though

0

It's not working because you copy & pasted the Script. You actually have to do programming on your own end; where both variables include a comment, you must declare the inputs.

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