So i have a part in my place that acts as lava and i wanted to make it so when the player steps into the lava the set frames from the screen gui would fade in and out as to make it look like the player is on fire. Heres what i came up to
out1 = script.Parent.outleft out2 = script.Parent.outtop out3 = script.Parent.outright out4 = script.Parent.outbottom in1 = script.Parent.inleft in2 = script.Parent.intop in3 = script.Parent.inright in4 = script.Parent.inbottom lava = workspace.burningLava local player = game.Players.LocalPlayer local touch=true function startburning(part) if touch==true then if part.Name == "burningLava" then for i=1,0.5,-0.1 do out1.BackgroundTransparency=i out2.BackgroundTransparency=i out3.BackgroundTransparency=i out4.BackgroundTransparency=i wait(0.1) end for i=1,0.7,-0.1 do in1.BackgroundTransparency=i in2.BackgroundTransparency=i in3.BackgroundTransparency=i in4.BackgroundTransparency=i wait(0.1) end end touch=false end end function endburning(part) if touch==false then if part.Name == "burningLava" then while out1.BackgroundTransparency<=1 do out1.BackgroundTransparency=out1.BackgroundTransparency+0.1 out2.BackgroundTransparency=out2.BackgroundTransparency+0.1 out3.BackgroundTransparency=out3.BackgroundTransparency+0.1 out4.BackgroundTransparency=out4.BackgroundTransparency+0.1 wait(0.1) end while in1.BackgroundTransparency<=1 do in1.BackgroundTransparency=in1.BackgroundTransparency+0.1 in2.BackgroundTransparency=in2.BackgroundTransparency+0.1 in3.BackgroundTransparency=in3.BackgroundTransparency+0.1 in4.BackgroundTransparency=in4.BackgroundTransparency+0.1 wait(0.1) end end touch=true end end player.Character.Humanoid.Touched:connect(startburning) player.Character.Humanoid.TouchEnded:connect(endburning)
For some reason the localscript wont work thou. Pls halp.