Proximity Prompt Trigger Doesnt Work

local char = script.Parent.Parent
local hum = char:WaitForChild("Humanoid")
local ProximityPrompt = script.Parent.ProximityPrompt


ProximityPrompt.Triggered:connect(function(Player)
	if char.Vampire.Value == true then
		script.Parent.Parent.Humanoid.Health -= 10
		ProximityPrompt.Enabled = false
	else
		ProximityPrompt.Enabled = true
		end
	end)
	
	

This is my script I am trying to damage the dummy on proximity prompt trigger but I dont know why its not working there are not even errors in the output
so if you know why pls tell me
Anyways have a good day.

Is your script running in the first place? Put a print somewhere outside the .Triggered connection

By not working, do you mean the prompt isnt even showing up? Or do you mean it does show up, but when you trigger it, it does nothing?

yea it just does nothing when I trigger it

mhm yea looks like it isnt even running because nothing gets printed in the output

Then that’s probably your issue. Assuming you’re using a localscript, put it directly in your character instead of a child of your character.

it still didn’t change anything

Show me your hierarchy and your script with the print in it

Don’t use LocalScripts to change health, as only one person would see the change in health, use a ServerScript to change health.

local plr = game.Players.LocalPlayer
local char = plr.Character
local dummy = script.Parent
local hum = dummy:WaitForChild("Humanoid")
local ProximityPrompt = script.Parent.ProximityPrompt

print("Hello")
ProximityPrompt.Triggered:connect(function(Player)
	if char.Vampire.Value == true then
		hum.Humanoid.Health -= 10
		ProximityPrompt.Enabled = false
	else
		ProximityPrompt.Enabled = true
	end
end)

What is your hierarchy? (Give us a screenshot of your explorer)

f6b366992c9731451ca084c062ad374c
didnt know what you mean by hierarchy but this is the dummy (inside the local script is just a sound nothing important)

Ah well there’s your problem. Local scripts only run when they’re inside of players, you have a one inside of a dummy. Replace it with a script.

You really shouldn’t use Local Scripts for health changing, I can give some code but im on mobile so this might not work

local ProximityPrompt = script.Parent.ProximityPrompt

ProximityPrompt.Triggered:Connect(function(Plr)
if Plr.Character.Vampire.Value then -- No need to add == true
script.Parent.Humanoid.Health -= 10
ProximityPrompt.Enabled = false
else
ProximityPrompt.Enabled = true
end
end)

I got it fixed now I just had a dumb mistake for myself sorry that I wasted your time still thanks for helping