✓ Accepted answer
Compare Instance.Value, not the Instance itself
PlayerSpeed is an Instance. You are comparing Instance with number 11 which obviously won't pass the if statement, you need to get the Value of the Running Instance. To do that all you have to do is change PlayerSpeed == 11 to PlayerSpeed.Value == 11
local PlayerSpeed = CharacterInfo:FindFirstChild("Running")
if PlayerSpeed.Value == 11 then
script.Parent.ImageTransparency = 0
else
script.Parent.ImageTransparency = 1
end
GetPropertyChangedSignal?
The other possible problem is that you want the icon to be visible every time the speed changes, right? I got it like this, for that you would use GetPropertyChangedSignal, it's a function of every Instance which returns event which fires when given property of it changes. In your case it would look something like this:
local PlayerSpeed = CharacterInfo:FindFirstChild("Running")
PlayerSpeed:GetPropertyChangedSignal('Value'):Connect(function()
if PlayerSpeed.Value == 11 then
script.Parent.ImageTransparency = 0
else
script.Parent.ImageTransparency = 1
end
end)
But it would need some improvements, this is just as an example.
Sources
GetPropertyChangedSignal