Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Certain rank and above in a group-only button?

Asked by 4 years ago

I need a button where only people above a certain rank in a certain group can make the function work.

function Play()
    script.Parent.Parent.Speaker.Sound:Play()
wait(40.6)
script.Parent.Parent.Speaker.Sound:Stop()

end
script.Parent.ClickDetector.MouseClick:connect(Play)

This is the script for the "Staff only" bit ive come up with

if plr:GetRankInGroup(5280317) >= 100 then

I doubt this is right, but i dont know what do to from here, i dont know where in the function to put that script.

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

So basically, all you want to do is to connect the function to the player pressing the button and then using an if statement.

local sound = script.Parent.Parent.Speaker.Sound

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    if player:GetRankInGroup(5280317) >= 100 then
        sound:Play()
        wait(40.6)
        sound:Stop()
    end
end)
Ad

Answer this question