How do I ranklock a proximityprompt?

Hello, so essentially ive been trying to ranklock my proximityprompts as if people press them it can ruin the entire roleplay aspect of my game…

Has anyone got any ideas of how this would work?

(this is my first post so like sorry if its in the wrong category lol)

6 Likes

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’?

3 Likes

So ranklock as in only ranks such as say for example 4+ could access it, ranks as in groupranks

2 Likes

image
So essentially this, these are ranks

3 Likes

Hi,

Do you want the proximity prompt to be visible to those who can’t access it ?

2 Likes

Yes. just ignore this bit im just letting devforum post

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.

2 Likes

Okay, how would the role part go which checks for your role numbers? (I dont script sorry lol)

1 Like

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.

1 Like

You just asked how to ranklock a proximity prompt, you didn’t ask in the original post what will the proximity prompt do.

1 Like

No need to do that on the client since you’re just wasting resources by sending requests to the server.

1 Like

However when done on the server, every Player will see the ProximityPrompt, which is (if I understand correctly) not intended.

1 Like

He said that he wants for every player to see the ProximityPrompt.

1 Like

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).

1 Like

You still check the rank on the server so toggling the enabled property on client is unnecessary.

1 Like

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.

1 Like

He said that he wants the prompt to be shown to all users.

1 Like

Sure I guess.

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:

image

and you can find the rank number from the Configure Group page:

As an example:

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.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.