first post and third time writing this, sorry 'bout crap formating...
I need help with this script, I want it to create a gui, then fade it, then delete it.
debounce = false script.Parent.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player and not debounce then debounce = true local gui = Instance.new('ScreenGui') gui.Parent = player.PlayerGui local frame = Instance.new('Frame') frame.Parent = gui frame.Size = UDim2.new(0, 1920, 0, 1080) frame.BorderSizePixel = 0 frame.BackgroundColor3 = 0,0,0 frame.BackgroundTransparency = 0 for i = 0, 1.05, 0.05 do frame.BackgroundTransparency = i wait(0.01) end gui:Destroy() frame:Destroy() debounce = false end end)
sorry, it's a terrible script. Anyway, the spaced out bit is the part that I believe is the problem. I've looked up tons of scripts to fade ScreenGuis but this just doesn't work... any help? :\
the script looks good; just the for loop might be the problem. also, we'd appreciate to know what you see when you run your game;
I'd recommend writing the loop like this in this case
local tran=0 repeat tran = tran+0.5 frame.BackgroundTransparency = tran wait(0.01) until frame.BackgroundTransparency <= 1