how do i get the player from proximityprompt.promptshown event?
local ProximityPrompt = script.Parent -- Replace this with the actual ProximityPrompt object
-- Define a function to be called when the prompt is shown
local function onPromptShown(player)
print(player.Name .. " triggered the prompt!")
-- You can perform actions based on the player who triggered the prompt
end
-- Connect the event handler to the PromptShown event
ProximityPrompt.PromptShown:Connect(onPromptShown)
Can you show us your explorer, the script is probably just in the wrong place
Make sure the script is on the server and not the client and check if the script is even running.
yes it is. but i am looking for an innovative solution
Never used this, but from reading, ProximityPrompt.PromptShown is only on the client, meaning you get the player using game.Players.LocalPlayer
HOW am i supposed to add some new prompt being added to the gamme connect via prompt shown so it displays a highlight if you see it
use remote event to communicate between client and server
You mean you want me to? Put a remote event. Inside of everything that I want to highlight. And if a prompt becomes visible, you w?ant me to fire the player and the? Object I ! want to highlight?
I would just use one remote event, and check to see what the proximity prompt is parented to and highlight that.
as PromptShown can be detected in localscript, you can use remote event to pass function from client to server, there’s no more way to detect this event
What do you mean by “add some new prompt being added to the game?” Unless you need everyone in the server to see something highlighted, etc., I recommend only highlighting it for the player who sees the prompt, meaning everything can be done locally, in the same script. There’s no way to completely secure a remote event when you’re only using PromptShown.
Personally, I would never use PromptShown with a remote event, function, or anything related to the server, nor can I even think of a good example where it is necessary to use the two together.
If you need something similar on the server, it’s possible to use magnitude and raycast to get similar results (all from the top of my head, don’t quote me on any of this).
Never mind, I solved the problem and you all were wrong. If you want to know the actual solution, you can message me.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.