ScreenGui script not working at all

And now nothing happens, wait i can figure it out alone

I think it’s something wrong with the position, go back to my code with

local gui = player:WaitForChild("PlayerGui")

and before doing anything, check everything, such as the position of the screenGui, or else you can put this script inside of the thing that you want to change the text of and just do

local gui = script.Parent

while true do
	local Customer = math.random(1,3)
	if Customer == 1 then
		workspace.RedHuman.Transparency = 0
		gui.Text = "Peperoni"
	elseif Customer == 2 then
		workspace.BlueHuman.Transparency = 0
		gui.Text = "Cheese"
	else
		workspace.GreenHuman.Transparency = 0
		gui.Text = "Nothing"
	end
	wait(30)
end
1 Like

Oh, i did it, i puted the script to the screenGui and changed the script to this:

repeat
local Customer = math.random(1,3)
if Customer == 1 then
workspace.RedHuman.Transparency = 0
script.Parent.List.Text = “Peperoni”
elseif Customer == 2 then
workspace.BlueHuman.Transparency = 0
script.Parent.List.Text = “Nothing”
else
workspace.GreenHuman.Transparency = 0
script.Parent.List.Text = “Cheese”
end
wait(30)
until Customer == 4

But thank’s for help!

1 Like

It’s almost identical to how I did it, but again, I really recommend doing a while true do instead of the repeat until you have going, and to make a variable for the gui to reduce repetition. But if it works, it’s all good! If you have anymore issues don’t be afraid to make another post!

2 Likes

Thanks for support, i never knew that peoples can be that nice!

3 Likes

That’s what I and others are here for! I wouldn’t want to ruin your support by being rude of course! Hope to help you with your other issues in the future!

2 Likes