How do I put permissions on this script? Only clickable for certain ranks

Anim.Ignition_L.ClickDetector.MouseClick:Connect(function()
    if System.E_1.Value == false then
        Anim.Ignition_L.BUTTON:Play()
        Anim.E_1.Motor.MotorMaxAcceleration = 1
        Anim.E_1.Motor.AngularVelocity = 100
        Anim.E_1.Startup1:Play()
        System.E_1.Value = true
    else
        Anim.Ignition_L.BUTTON:Play()
        Anim.E_1.Motor.MotorMaxAcceleration = 4
        Anim.E_1.Motor.AngularVelocity = 0
        Anim.E_1.Shutdown1:Play()
        System.E_1.Value = false
    end
end)

Anim.Ignition_R.ClickDetector.MouseClick:Connect(function()
    if System.E_2.Value == false then
        Anim.Ignition_R.BUTTON:Play()
        Anim.E_2.Motor.MotorMaxAcceleration = 1
        Anim.E_2.Startup2:Play()
        Anim.E_2.Motor.AngularVelocity = 100
        System.E_2.Value = true
    else
        Anim.Ignition_R.BUTTON:Play()
        Anim.E_2.Motor.MotorMaxAcceleration = 4
        Anim.E_2.Shutdown2:Play()
        Anim.E_2.Motor.AngularVelocity = 0
        System.E_2.Value = false
    end
end)

try

local permissionsInt = 255
ClickDetector.MouseClick:Connect(function(player)

    if player:GetRankInGroup() >= permissionsInt  then
        -- hello owner
    end
end)
1 Like