Hello!

Thank's for taking the time to read my thread. I'm coding a simple health-bar, however, when I try to initiate the callback for the HealthChanged signal, my program tosses me an "Unexpected Unicode Character" error, among the likes of:

Line 1: U+2028. Did you mean ' '?

I'm not sure where this issue is apparent in my code, as I don't see any issues. Can anyone point me in the right direction?

local players = game:GetService("Players")
local player = players.LocalPlayer

local healthGui = script.Parent
local healthBackground = healthGui:WaitForChild("Background")
local healthBar = healthBackground:WaitForChild("healthFrame")

local function adjustHealth(character)
	local humanoid = character:WaitForChild("Humanoid")
	humanoid.HealthChanged:Connect(function(currentHealth)
		healthBar:TweenSize(
			UDim2.new(currentHealth/humanoid.MaxHealth, 0, 1, 0),
			Enum.EasingDirection.Out,
			Enum.EasingStyle.Linear,
			.1,
			true
		)
	end)
end

adjustHealth(player.Character)
player.CharacterAdded:Connect(adjustHealth)

6 comments

0

theres an invisible character somewhere in your script, just delete it

0

I think its line 11 after the (

0

I cannot find it, how would I search for it?

0

highlight all your code, see if there is an invisible character standing out and delete it

0

That is exactly what I did. Wait a minute, it is showing me that line 9-10 is one line on it's own:?

0

Nevermind! I found it, thank you greatneil80!