A part with ProximityPrompt | Roblox Creator Documentation is activated for all players on the map.
Is there a way to enable it only for certain players?
set its enabled property to true in a local script
Connect a remote event with :FireClient() to make the ProximityPrompt.Enabled set to false to specific players in localscript.
If I could also build onto this: make sure you have a way to track from the server who’s legally allowed to trigger a prompt. Just a simple dictionary or whatever is fine.
If you just disable the prompt then either a mistaken or unpredictable reactivation of the prompt or an exploiter could reenable the prompt and commit the action. The server should be able to reject any trigger actions from clients who can’t interact, assuming the prompt has a server-side effect.
Here’s the problem: ProximityPrompt | Roblox Creator Documentation is only triggered in Localscript.
In this way an exploiter can alter this behavior by giving himself the authority to display the prompt.
@SaintlySoup @Qariter
I can’t do these changes in LocalScript because an exploiter can easily change this property and get access to a function that is not allowed for them.
Do a sanity check on the server. [use a if statement when its triggered] along with the client script to disable it.
you should listen to Triggered not what you said,
Triggered can be used in the server
I know, however, the prompt will still be shown improperly to the unauthorized player.
Probaly create a playerlist and do an if/else statement. Eg.
local access = " Players here" --Players in here.
local Proximity = script.Parent.ProximityPrompt
while true do
--Your statement here
end
Note: I just suggesting. It probaly won’t work
that can happen
should work
To make it clearer I even improved the title:
How to avoid Proximity Prompt being shown for some players?
Apparently, this can only be done in LocalScript and thus it is impossible to avoid a change by exploiters.
Just use serverside checks to see if they are eligible to interact with it. It’s the exploiters fault for enabling to show a proximityprompt that doesn’t work for them if it’s hidden via a LocalScript. There should be no issue with this, and it’s probably what you’re looking for.
You could just detect PromptTriggered on the client using ProximityPromptService and call the server with a remote event:
local ProximityPromptService = game:GetService("ProximityPromptService")
local Part = workspace.Part --Object the ProximityPrompt is inside of
local Event = "RemoteEvent"
ProximityPromptService.PromptTriggered:Connect(function(PromptObject) --Returns ProximityPrompt that was triggered
if PromptObject:IsDescendantOf(Part) then --Checks if prompt triggered is the correct one
Event:FireServer()
end
end)
then add all the exploit checks you need on the server.
If it’s a client-only prompt then it shouldn’t be that huge of a problem because ultimately the interaction will only be relevant to the client. Just make sure that whatever you’re doing isn’t game critical to the point where an exploiter interacting with the prompt could affect gameplay noticeably.
Client-only systems don’t necessarily need any consideration for potential exploiters but you should also be mindful about how your experience is setup such that an exploiter modifying a client-only system doesn’t have any impact on other players.