Why isn't this working?

The script doesn’t do what i want it to do.
I want it to do this:
player.PlayerGui.Damage.ImageLabel.ImageTransparency == (PotHum.Health/100)

But it just ignores that part and I want to know why.

Here is the script:


local PotHum = script.Parent:FindFirstChild("Humanoid")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
local character = script.Parent
local player = players:FindFirstChild(character.Name)
local GuiFresh = ReplicatedStorage:FindFirstChild("GuiFresh")

function refresh()
	print("refresh")
	local GuiFresh = ReplicatedStorage:FindFirstChild("GuiFresh")
	GuiFresh:FireClient(player,player.PlayerGui.Damage.ImageLabel.ImageTransparency == (PotHum.Health/100))
end

script.Parent.Humanoid.Changed:Connect(refresh)

It doesn’t throw any errors.

It doesn’t work because it thinks you are trying to pass an argument with the two equal signs. From the look of your code, it seems like you are trying to set the transparency of something. Do this outside of the FireClient and only use one equal sign since you are setting a value to something.

function refresh()
	print("refresh")
	local GuiFresh = ReplicatedStorage:FindFirstChild("GuiFresh")
        player.PlayerGui.Damage.ImageLabel.ImageTransparency = (PotHum.Health/100)
	GuiFresh:FireClient(player,player.PlayerGui.Damage.ImageLabel.ImageTransparency)
end
2 Likes