hello again! i made a pizza with a click detector when you click it its supposed to show a gui but it dosent show anything and all i see in the output is the print messages
script:
script.Parent.ClickDetector.MouseClick:Connect(function() script.Parent.Parent.SoundEmmiter.YumYum:Play() print("Somebody ate Altera's pizza!") wait(3) print("NOW THEY WILL PAY FOR IT") game.StarterGui.PizzaGui.Enabled = true wait(1) game.StarterGui.PizzaGui.PizzaMessage.Text = "Mhmm.. This pizza tastes good!" wait(4) game.StarterGui.PizzaGui.PizzaMessage.Text = "Uhm.. why do i hear boss music?" game.StarterGui.PizzaGui.Enabled = false wait(4) game.StarterGui.DiedScreen.Enabled = true game.StarterGui.DiedScreen.Front.DeadMessage.Text = "YOU DIED" wait(3) game.StarterGui.DiedScreen.Front.DeadMessage.Text = "you should have not ate that pizza.." end)
btw im a beginner scripter :D
Hello! :D
Your problem here is that you are using StarterGui instead of PlayerGui. StarterGui is the Gui that you edited in ROBLOX studio. However, when the game starts up, the GUI's in StarterGui get cloned into each player's PlayerGui. Therefore, anything you script must be done so from the PlayerGui (If that didn't make sense, I'd be happy to try to explain it in a different way)
What you need to do is to detect which player clicked the pizza, so you would start your script off with this:
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
Then you need to change all of your "game.StarterGui" to "plr.PlayerGui"
Here's would be the solution to the first part of your script - if you can't figure out the rest I'm happy to help
script.Parent.ClickDetector.MouseClick:Connect(function() --This line has been edited script.Parent.Parent.SoundEmmiter.YumYum:Play() print("Somebody ate Altera's pizza!") wait(3) print("NOW THEY WILL PAY FOR IT") plr.PlayerGui.PizzaGui.Enabled = true --This line has been edited wait(1) plr.PlayerGui.PizzaGui.PizzaMessage.Text = "Mhmm.. This pizza tastes good!" --This line has been edited
I hope this helps! If you have any questions, please ask :)
Hey! Use 'game.StarterGui.PizzaGui.Visible = true' Instead. I hope i was able to help!
To fix the screen gui, you would have to use PlayerGui which is located in game.Players.
script.Parent.ClickDetector.MouseClick:Connect(function(Click) local Player = game.Players:GetPlayerFromCharacter(Click) --gets the player script.Parent.Parent.SoundEmmiter.YumYum:Play() print("Somebody ate Altera's pizza!") wait(3) print("NOW THEY WILL PAY FOR IT") Player.PlayerGui.PizzaGui.Enabled = true wait(1) Player.PlayerGui.PizzaGui.PizzaMessage.Text = "Mhmm.. This pizza tastes good!" wait(4) Player.PlayerGui.PizzaGui.PizzaMessage.Text = "Uhm.. why do i hear boss music?" Player.PlayerGui.PizzaGui.Enabled = false wait(4) Player.PlayerGui.DiedScreen.Enabled = true Player.PlayerGui.DiedScreen.Front.DeadMessage.Text = "YOU DIED" wait(3) Player.PlayerGui.DiedScreen.Front.DeadMessage.Text = "you should have not ate that pizza.." end)