doesnt work, really strange.
script.Parent.Triggered:Connect(function() print("Test") end)
nothing outputs the local script is inside of the proximity prompt, i tried using remote events but when i do OnClientEvent (yes i called it through a regular script) nothing happens again. Its really frustrating. Nothing works
It's important to know that LocalScripts
cannot run in workspace
. Instead, you need to use a regular script
and RemoteEvents
.
For example, in the ProximityPrompt
under workspace
you would use a regular script
with something like this:
script.Parent.Triggered:Connect(function(plr) game:GetService("ReplicatedStorage"):FindFirstChild("RemoteEvent"):FireClient(plr) end)
Note: You will need to have a RemoteEvent
in ReplicatedStorage
Then in a LocalScript
which I would put in StarterPlayerScripts
you would write something like this:
game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent").OnClientEvent:Connect(function() -- Whatever you want to happen print("ProximityPrompt triggered") end)
Alternatively
You can just reference the proximity prompt from a LocalScript
in StarterPlayerScripts
(or another place where LocalScripts
work)
This would look something like:
game.workspace.Part:WaitForChild("ProximityPrompt").Triggered:Connect(function() -- Whatever you want to happen print("ProximityPrompt triggered") end)