My script for burning players is not working, but not giving errors?

I am working on a script that is supposed to give a “Burning” status and make the player get hurt over time, but I have not gotten errors, prints nor any other type of feedback when I run the script, yet the script does not run.

Anything I need to change up in my script?

script.Parent.Burning.AttributeChanged:Connect(function()
	print("Change got!")
	if script.Parent.Burning.Value == true then
		print("Burning is true!")
		local fire = game.ReplicatedStorage.Fire:Clone()
		fire.Parent = script.Parent:FindFirstChild("FaceCenterAttachment")
		for i = 1, 30 do
			print("Ouch!")
			wait(0.5)
			script.Parent.Parent.Humanoid:TakeDamage(1)
		end
		print("Burn is over!")
		script.Parent.Burning.Value = false
		fire:Destroy()
	end
end)

Note: Not even print("Change got!") works.

Gotta debug a bit further.

  1. Is the script running in the first place? Add a print debug at the very top of the script.

  2. Here is a second tricky thing which is client-server interactions, the second cause of why is this script not doing anything. Are you changing the attributes in the client in the explorer? If so and if the script is a server script then this attribute change will not replicate and the server will not notice, solution is to do it server sided.

The Burning attribute is being changed by a lava block I have placed to test it, it does not work for some reason

EDIT: The script DOES run, according to point 1 in your comment, but it still does not run the rest of the code

Well then let’s focus on triggering the attribute changed event manually to try and get" changed got " to work. Hop into server mode during play testing https://developer.roblox.com/en-us/articles/game-testing, and modify the attributes of the “Burning” instance. If it prints then it’s the problem with the lava brick, if it doesn’t then tbh I’m not sure with the information being given, hope this helps.

I have went into the part multiple times, even with the forcefield not on my character, and I have selected the boolvalue and the value indeed becomes true but, for some reason the entire script refuses to run.

Wait you are using a bool value and changing it’s value but not it’s attribute? Might want to use get .Changed or .Get property changes events instead. Value changes is a property and attributes is well not exactly as it’s a different system since it’s newer.

1 Like

That worked like a charm! I thought that the Value was a Attribute

1 Like