How to disable/enable prompts for different clients

Hey, I’m working on a system where the closest interactable object gets highlighted and gets a prompt. There’s no issues when theres 1 player playing, the highlight and prompt appears and the drawer/door moves as intended.

And when there’s multiple, it works fine too, except for one thing:
The prompts don’t disable for other clients, if 2 client’s are close to the same object. This is just a looks issue, since I added checks on the server, but it just looks bad that when an object is moving the prompt stays visible.

How would I disable it for all clients whenever the object is moving?

If it appears for all, do it on client? or I dont understand sum

In your case would be better to use roblox’s proximity prompts

No, it doesn’t show for all clients, it only shows the prompt for the certain client that is close to the interactable object. Say for example there’s a drawer, if a player is close to it, it will show a prompt for the player that is close only.

Use proximity prompts? or what is your issue

do it on the client? I have a local script you can reffer to

local promptService = game:GetService("ProximityPromptService")


local abNormalParent = {"door", "HumanoidRootPart"}

local function showPrompt(prompt)
	if table.find(abNormalParent, prompt.Parent.Name) then 
		local highlight = Instance.new("Highlight")

		highlight.FillColor = Color3.fromRGB(255, 255, 255)
		highlight.FillTransparency = 0.7
		highlight.OutlineColor = Color3.fromRGB(255, 255, 255)
		highlight.OutlineTransparency = 0
		highlight.DepthMode = Enum.HighlightDepthMode.Occluded
		highlight.Parent = prompt.Parent.Parent
	end
	
	if not table.find(abNormalParent, prompt.Parent.Name) then 
		local highlight = Instance.new("Highlight")

		highlight.FillColor = Color3.fromRGB(255, 255, 255)
		highlight.FillTransparency = 0.7
		highlight.OutlineColor = Color3.fromRGB(255, 255, 255)
		highlight.OutlineTransparency = 0
		highlight.DepthMode = Enum.HighlightDepthMode.Occluded
		highlight.Parent = prompt.Parent
	end

end

local function hidePrompt(prompt)
	
	if table.find(abNormalParent, prompt.Parent.Name) then
		local highlight = prompt.Parent.Parent:FindFirstChild("Highlight")
		if highlight then
			highlight:Destroy()
		end
	end
	
	if not table.find(abNormalParent, prompt.Parent.Name) then
		local highlight = prompt.Parent:FindFirstChild("Highlight")
		if highlight then
			highlight:Destroy()
		end
	end
	
end

promptService.PromptShown:Connect(showPrompt)
promptService.PromptHidden:Connect(hidePrompt)

I alredy am using proximity prompts, but since im cloning and parenting them on the client other clients cant refer to that prompt to disable it

I will try this and see how it goes

Why would you do so though

kkkkkkkkkkk

Im just gonna answer the question above, baby steps.

local movingpart = script.Parent -- Assume script is in part
local hadfired = false
local disableprompt = -- That remote event here
game.RunService.PreSimulation:Connect(function()
   if part.AssemblyLinearVelocity --[[Change the property to what ur using]]~= Vector3.zero then
      if hadfired then return end
      hadfired = true
      disableprompt:FireAllClients(false)
   else
      if not hadfired then return end
      hadfired = false
      disableprompt:FireAllClients(true)
   end
end)
-- I think you know how to disable the prompt..

Because I want them to only be visible to the client that is close to them, which is why this works perfectly when there’s 1 player but looks janky when there’s multiple.

Let me clarify: The actual moving of objects and closing/opening/whatever works fine with any amount of players, it just doesn’t disable the prompt when the object is moving which I think looks bad.

I don’t think this would work for me, as I’m creating the prompt on the client. It would be an easy fix if I did so on the server, but that would also complicate enabling/disabling/ and also destroying the prompt.

On second thought, this also woudn’t work for me, as I’m creating the prompt on the client which would then not fire the promptshown event for other clients.

robloxapp-20240919-1702133.wmv (1.4 MB)
(excuse the quality roblox’s video recorder is not the best)
Here’s a video for clarification, when I open the drawer the prompt gets disabled for the duration that it’s moving. Now when 2 players have the same closest interactable and one of them open the drawer, the prompt stays visible for the other player.

Issue has been fixed, I just ahd to change the system to be based on the server creating the prompts. There is still one small issue but not related, thanks to everyone who tried to help o7

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