What do you want to achieve? Basically i have a downed script, it works perfectly however it seems trigger to whenever player gets hit from a part, i don’t want that to happen i only want the downed script to function if player gets hit by another player.
What is the issue? Downed script still seems to function even if part has attributes.
Here is my script i use that gets part attributes! If there is any solutions i can try let me know.
local Inst = game.Workspace.SafeZoneGroup.PartFFF
if Inst:GetAttribute("IgnoreDown") then return end
humanoid.Changed:Connect(function()
if humanoid.Health == 5 then
script.Parent.Value = true -- Player is downed
elseif humanoid.Health >= 30 then
script.Parent.Value = false -- Player is not downed anymore.
end
end)
local Inst = workspace.SafeZoneGroup.PartFFF
humanoid.Changed:Connect(function()
if Inst:GetAttribute("IgnoreDown") then return end
if humanoid.Health == 5 then
script.Parent.Value = true -- Player is downed
elseif humanoid.Health >= 30 then
script.Parent.Value = false -- Player is not downed anymore.
end
end)
here it is, it is located in startercharacter and is a normal script. (oops forgot to check)
local Char = script.Parent.Parent
local humanoid = Char:WaitForChild("Humanoid")
script.Parent.Value = false
local RegenType = Char.Health
local Inst = workspace.SafeZoneGroup.PartFFF
humanoid.Changed:Connect(function()
if Inst:GetAttribute("IgnoreDown") then return end
if humanoid.Health == 5 then
script.Parent.Value = true -- Player is downed
elseif humanoid.Health >= 30 then
script.Parent.Value = false -- Player is not downed anymore.
end
end)
Why are you using changed event as it fires everytime it detects movement. I made a new script here
local humanoid = Char:WaitForChild("Humanoid")
script.Parent.Value = false
local RegenType = Char.Health
local Inst = workspace.SafeZoneGroup.PartFFF
humanoid.HealthChanged:Connect(function(health)
print("Health Changed Fired!")
if health <= 5 then
script.Parent.Value = true -- Player is downed
print("Player is downed!")
elseif health >= 30 then
script.Parent.Value = false -- Player is not downed anymore.
print("Player is not downed!")
end
end)
Ohh, no wonder why it isn’t working. It’s because the attribute still exists. You should have specified earlier. When you said you checked, I thought you actually fully checked.
Switch your script to this:
local Inst = workspace.SafeZoneGroup.PartFFF
humanoid.Changed:Connect(function()
if Inst:GetAttribute("IgnoreDown") == "" then return end
if humanoid.Health == 5 then
script.Parent.Value = true -- Player is downed
elseif humanoid.Health >= 30 then
script.Parent.Value = false -- Player is not downed anymore.
end
end)
Same problem as earlier… the script doesn’t seem to function regardless if player is being touched by that part or not… (Basically entire script breaks)