If statement seems to break everything else in the script

Hi, for whatever reason the If statement in my script seems to instantly break it without actually
putting an error in the output, I’ve used printing to see exactly where it stops working and its in the it statement, I’m pretty sure my pathing is correct so I’m honestly not sure why it doesn’t work. Sorry for the broken english but here’s the script.

game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:connect(function(character)

		game.ReplicatedStorage.CustomizationSaving.OnServerEvent:Connect(function(plr)
			 
			print "ok here1"
			if character.DataHair.Value == 1 then
				print "ok here2"
				Player.CustomizationSaving.Hair.Value = 1
				print "this workd i think!1'"
			
	end
		end)
		end)

	end)

Any and all help or advice would be greatly appreciated.

it checks if the value is one and tries setting it to one again,
It most likely stops working since the hair value doesn’t equal one; So it just returns nothing, you would have to use an else or a elseif statement to make it return something else

1 Like

The strange thing was that the DataHair Value was always set to 1 during my testing when the script would break, I’m 100% sure that the pathing is correct because I’ve checked it and it has worked fine with other scripts but not this one.

hmmm try using an else statement and see if that returns anything

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.