Check if part has attributes and if it does return

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

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

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

Nope it still doesn’t work, it just made the entire script not function :frowning_face:

Anybody out there? any help is appreciated! :frowning_face:

There’s something wrong with your attribute then. Are you sure the instance actually has an attribute with that name?

Make sure that all the variables in the script are not nil.

None of the variables in the script nil and all the attributes are in a seperate part.

Yes, of course i made sure it exists before writing this down.

I don’t know why this could be happening then, especially since it works on my own studio.

Here is the part attributes:
image

you need to show your full script and tell us where all stuff in workspace for people to help you further! Also is ignore down a string attribute?

Yes it is.

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)

I think it should be
local char = script.Parent
Because your char is printing workspace.

Nope it’s not beacuse of:
image

The second parent in script.Parent.Parent is the character model.

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)

Tell me the value of the attribute.

And tell me if its a LocalScript + where it’s located.

The value of it is ‘nil’ but i can change it if wanted.

Yes it is a localscript, located in startercharacter
Character is referenced by using Local Char = Script.Parent.Parent

Okay so the string value for it is:
“nil”
right?