I Think This Will Be Very Dumb Question, Am Making Script That Hide Prompt To Player That Activated Prompt For 5 Second, And For Some Reason, Script Not Work, Got No Error In Outputs.
It seems like you putted this script inside Workspace. As @hasoco said, LocalScripts doesn’t run inside Workspace. Instead, put this LocalScript inside StarterPlayerScripts and write the following code-
It depends on what he wants. He wants that it disables for the client who triggered it. If we use a Script, then this would be disabled for all the players, not just the player who triggered it.
local detectorPart = script.Parent -- Assuming this script is inside of the part
local proximityPrompt = detectorPart.ProximityPrompt -- Assuming this ProximityPrompt is inside of the part
proximityPrompt.Triggered:Connect(function(player)
proximityPrompt.Enabled = false
task.wait(5)
proximityPrompt.Enabled = true
end)
Okay so the problem is that you need a remote event.
A remote event lets the server communicate with the client, which is exactly what you need in your case, since a LocalScript can’t run in the Workspace like everyone has said 2,000 times.
Okay so you’ll need 2 new scripts; A server script that can go anywhere in the Workspace (preferably a child of the prompt) that references the proximity prompt, and a local script that is parented to StarterPlayerScripts.
Then, create a RemoteEvent and place it in ReplicatedStorage. Name it visRemote.
Local script:
local remote = game.ReplicatedStorage:WaitForChild("visRemote")
remote.OnClientEvent:Connect(function(prompt)
prompt.Visible = false
end)
Server script: (assuming script is a child of proximity prompt in this case)
local remote = game.ReplicatedStorage:WaitForChild("visRemote")
local detector = script.Parent
detector.Triggered:Connect(function(player)
remote:FireClient(player, detector)
end)
The beauty of remote events is that you can use this for as many proximity prompts as you want.
I hope this makes sense. As said before, since a prompt can’t be directly activated via a local script, a RemoteEvent is needed so the server can fire the client.