Disabling prompt locally using PPS not working

I made an object carrying script using prompt’s, all of it handled by 1 server script, with the objects and player having BoolValue attributes of being carried.

What is the issue? The issue is I am trying to make it where the prompt is disabled on client side if the object is being carried by a different player, I wrote it in many different ways in the local script, even tried bindable events but couldn’t figure it out

What solutions have you tried so far? I looked at past posts, tried to apply the same logic from the API. no luck. Can’t figure out where the issue is, in most cases it doesn’t print out any errors



The prompt should only be visible for the carrier
This is the local script code. If you would like to see pervious code attempts or the main handler please ask.

local PPS = game:GetService("ProximityPromptService")

local Player = game.Players.LocalPlayer

PPS.PromptTriggered:Connect(function(prompt, playerToDisableFromt)
	print(prompt)
	local crate = prompt.Parent
	print(crate)
	if crate:GetAttribute("isCarried") == true and crate:GetAttribute("Carrier") ~= Player.Name then
		prompt.Enabled = false
	elseif prompt.Parent:GetAttribute("isCarried") == false then
		prompt.Enabled = true
	end
end)
1 Like
  • So lets say there are crates on the floor.
  • All of them has Prompts
  • A player grabs a crate, then the prompt from that crate should be hided in All Clients, except the one who activated it
  • The prompt changes text to Drop instead of Grab for the player who is holding it
  • Once player activates Drop prompt again, drops the box, change text back to Grab, and enable that prompt to All Clients again ?

Thats the goal?
You tried using a remote:FireAllClients(crate) so each client is asked to hide the prompt which is inside that crate when any player triggered the function connected to the Prompt?
(should be done in server side, which would hide the prompt for all players)

Or instead of FireAllClients(), iterate all players in game, FireClient(player, crate) for all except the player that Fired the event of grabbing a crate

1 Like

spot on with the goals, they all function as i intend except for the fact the prompt doesn’t hide for other players when being carried

i tried to write a remote event to fire but didn’t know how to correctly, where or if the way i tried firing it was incorrect

Player:GetAttributeChangedSignal("isCarrying", true):Connect(function(state)
			game:GetService("ReplicatedStorage").promptLocal:FireClient(Player,not state)
		end)

this is said attempt in the promptHandler server script

I think the issue could be in how you are handling the prompt triggered.

There is a special reason why everything is client sided?

I would try this.
A ServerScript using the PPS, listening all prompts fired. When a signal is received and prompt being check, perform a loop with game.Players:GetPlayers(), and remote:FireClient(player, prompt) to all players except the main player who activated the prompt.

In a Local Script, you listen the remote signal, and hide the prompt received by the client.

In that way, nobody can see the prompt except the player who activated it

1 Like

nothing is client sided except for a script that spawns carriable objects, carrying mechanism is also handled by the server

PPS.PromptTriggered:Connect(function(Prompt, Player)
	-- carrying script code block
end)

I’ll try your method in a moment and get back to you

I mean something like this:

The server script listening the prompts, and asking all clients except the owner of the crate to hide that prompt:
(there is a RemoteEvent in replicated storage to handle the client side)

local PPS = game:GetService("ProximityPromptService")

local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")

PPS.PromptTriggered:Connect(function(prompt, plrFired)
	warn(prompt, "fired by:", plrFired) -- a prompt fired by a player print
	if prompt.Name == "CratePrompt" then -- a check of the prompt
		for _, plr in pairs(game.Players:GetPlayers()) do -- Firing all clients in a loop
			if plr ~= plrFired then -- fire all clients except the one that fired the prompt
				RemoteEvent:FireClient(plr, prompt)
			else
				-- Change text on prompt for the player holding the crate
				-- functions etc
			end
		end
	end
end)

And a Local Script all clients should have, that will listen the call from server to hide an specific prompt:

local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")

RemoteEvent.OnClientEvent:Connect(function(prompt)
	warn("prompt to hide on this client", prompt)
	prompt.Enabled = false
end)

I meant this script is client sided (the issue in question):

If you handle the Enabled property in that client side script, the only player that will perceive the changes of those prompts would be the client itself, and no way to tell other clients to hide or unhide the prompt, only server can do that, thats why I suggested, handle the PromptTriggered event on ServerSide by using something like the first script I sent in this message.
(or let the client Fire a remote to server, then server fire a remote to all other clients… but if ProximityPrompt already does that, no need for extra remote calls)

1 Like

man, I can’t believe all it took was that. Thank you so much <3

additional question, would this event cause any server lag if there were many objects being handled?

1 Like

Everytime that a player activates a prompt, is asking server to perform a little loop to fire a remote to “all clients”. Logical the more crates and the more players the more calls to server to perform that loop and fire remotes. Woulf be about testing it.

And improve the approach, maybe trying to hide the prompts server side, it will reflect the same way as using the remote. Once you get the call on the ServerScript, hide that prompt in server side, and use a remote to ask the owner of the crate to be one that has the prompt enabled.
In that way you skip the remote call on a loop to all other clients, and would be hiding that prompt on serverSide.

The amount of crates, remotes calls, etc, I think will depend on the security you want for your system, cause, if you dont want exploiters doing everything they want, you need to rely on server, but, at some point you could reach a limit of what server can handle. So, I think everything depends on all the systems that server should handle at the same time, taking in count the best possible security/sanity check, so, at some point, theres a limit of how many checks the server can handle, and that will tell you the max amount of checks/systems/crates etc that should be secured or needed the server to handle it.

1 Like

I’ll keep that in mind, thank you soo much :slight_smile:

1 Like

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