What do you mean by ‘ranklock’, like so certain ranks can access this proximity prompt and others can’t? And can you explain what do you mean by ‘ranks’?
In the script where the proximity prompt is being activated just check if the rank is bigger than 3 using player:GetRankInGroup(group id), if it is bigger then run the script.
You could instantiate the ProximityPrompt on the client (you would have to check if the client has the appropriate rank) in a LocalScript and send remotes to the server when triggered. Make sure to validate the rank on the server.
Create the ProximityPrompt on the server as enabled=true and then toggle its enabled property to false on clients that don’t have the rank. This can be done with a script with RunContext=Client under the ProximityPrompt; that way it’ll run on all clients but you can still easily use script.Parent from inside the script. On the server make sure to validate that the player has the rank before allowing them to trigger the action, because exploiters are able to just toggle the enabled property back and attempt to trigger the action (they can do anything a localscript can do and more on their client).
Do you want to confuse the user by showing them prompts that do nothing when triggered? If not, hide them unless they have permission to use them.
Checking the rank on the server is defense in depth, not redundant. Exploiters can bypass the client-side disabling of instances that are enabled on the server. That’s why you also check on the server. But hiding it for clients who can’t use it should be a desired behavior, I would assume.
In the script that handles the ProximityPrompt being triggered they can use Player:GetRankInGroup to check what the player’s current rank is, then return if it’s not high enough:
proximityPrompt.Triggered:Connect(function(player)
if player:GetRankInGroup(--[[group id here]]) < --[[required rank level here]] then
return -- do not continue
end
-- do something here for when the player does have permission...
end)
On the Roblox website, you can find the group ID from the URL of the group page:
and you can find the rank number from the Configure Group page:
proximityPrompt.Triggered:Connect(function(player)
if player:GetRankInGroup(5234523) < 254 then -- if their rank is lower than Administrator
return -- do not continue
end
-- do something here for when the player does have permission...
end)
They’ll need to replace the ID and rank number with ones from their own group though if they want it to work.