I don't work with repeats a lot so I don't know how to do this...

script.Parent.Touched:connect(function(h)
	local player = game.Players:FindFirstChild(h.Parent.Name)
	local gui = Instance.new("ScreenGui", player.PlayerGui)
	local frame = Instance.new("Frame")
	frame.Size = UDim2.new(1, 0, 1, 0)
	frame.Parent = gui
	frame.BackgroundColor3 = Color3.new(255,255,255)
	wait(3)
	repeat
		frame.BackgroundTransparency = frame.BackgroundTransparency+.1
		wait(1)
	until frame.BackgroundTransparency == 1
	gui:remove()
end)

This is the part that won't work...

	repeat
		frame.BackgroundTransparency = frame.BackgroundTransparency+.1 --Not full script
		wait(1)
	until frame.BackgroundTransparency == 1
	gui:remove()

Why won't this stop? I tried to add a "then" but it doesn't work. It won't delete the gui and it won't stop adding the BackgroundTransparency even after it reaches 1. Help would be appreciated! Explanation too!

4 comments

0

On line 12/4, have you tried using '>='? '>=' is used in loops [while true do end, repeat until nil], and if statements, or, to dumb it down, says if 'Number' is equal or greater than 'Number'.

0

@Alpha, is there a way to only insert one gui instead of 3 or 5?

0

I think it is possible, but I'm not too sure, for me I create the GUI at the start, then further in the code I Clone the original, and set the Cloned GUI's Parent to the PlayerGui, also, I am sorry if I misunderstood your question, and gave a bad comment.

0

It worked actually! At first I didn't get it because I wasn't used to repeats but it works! Thanks!