Trying to make static that slowly becomes more and more apparent as i get closer

Title lol

wait(.2)
local plr = script.Parent.Parent.Parent.Parent
local char = plr.Character
local fredy = game.Workspace.ah


local distance = (fredy.Part.Position - char.Torso.Position).magnitude

while true do
	wait(0.03)
	script.Parent.Image = "http://www.roblox.com/asset/?id=7315710718"
	wait(0.03)
	script.Parent.Image = "http://www.roblox.com/asset/?id=7315712298"
	wait(0.03)
	script.Parent.Image = "http://www.roblox.com/asset/?id=7315713137"
	wait(0.03)
	script.Parent.Image = "http://www.roblox.com/asset/?id=7315713830"
	wait(0.03)
	script.Parent.Image = "http://www.roblox.com/asset/?id=7315715074"
	wait(0.03)
	script.Parent.Image = "http://www.roblox.com/asset/?id=7315716308"
	wait(0.03)
	script.Parent.Image = "http://www.roblox.com/asset/?id=7315717041"
	wait(0.03)
	script.Parent.Image = "http://www.roblox.com/asset/?id=7315717704"
	wait(0.03)
	script.Parent.Image = "http://www.roblox.com/asset/?id=7315718212"
	wait(0.03)
	script.Parent.Image = "http://www.roblox.com/asset/?id=7315718895"

end

while true do
	print(distance)
	script.Parent.ImageTransparency = distance
end

For some reason it won’t even appear, no matter how close i get
It also does not print the value of distance

nevermind i think i have brain issues

In your loop:

while true do
    local distance = (fredy.Part.Position - char.Torso.Position).magnitude
    print(distance)
    script.Parent.ImageTransparency = distance
end
    
4 Likes

The second while loop is not running because of the the first one, everything that you put after a while loop won’t run until the while loop has ended.

sorry if this is necroposting but just use spawn(function(), it’s easy.