Triggered event wont work on client side for some reason

So i was making a system where you can trigger a proximity prompt thats on another player, then when its triggered it sends both the player who triggered the prox and who owns the prox.

but it doesnt work for some reason, i put a print after
prox.triggered:connect(Function(Pask)) [on client] and it never works!

Code fragment:

local sig = game.ReplicatedStorage:WaitForChild("Signals").Core_Events
local req = sig:WaitForChild("requested")
local mes = sig:WaitForChild("message")
local ask = sig:WaitForChild("ask")

local Pgot = game.Players.LocalPlayer
repeat wait()
until Pgot.CharacterAppearanceLoaded
task.wait(0.3)
local selfprox:ProximityPrompt = Pgot.Character:FindFirstChildOfClass("ProximityPrompt")

selfprox.Triggered:Connect(function(Pask)
	print("happened")
	req:FireServer(Pgot, Pask)
end)
selfprox.Enabled = false

and yes ik its a bit messy but its only a fragment.

edit: yes im using remote events in replicated storage.

Where is the script located?

starterplayer scripts, The script works, just not the event (im gonna prob try and use instance.New())

did you check if selfprox even exists? or if that part of code even runs? try putting a print after task.wait(0.3)

1 Like

Mhm, ive tried some possible solves but it still wont bugde, very weird.
Ill give yours a try aswell.

(and sorry for the late response :skull:)

edit: fixed some minor spelling mistakes in this message

Try print(selfprox) because :FindFirstChild has the potential to be nil.
Also use
local character = Pgot.Character or Pgot.CharacterAdded:Wait()

It’s more efficient that way

1 Like