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.
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)
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)