Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

screen gui dosent show up on screen how do i fix this?

Asked by 4 years ago

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:

01script.Parent.ClickDetector.MouseClick:Connect(function()
02    script.Parent.Parent.SoundEmmiter.YumYum:Play()
03    print("Somebody ate Altera's pizza!")
04    wait(3)
05    print("NOW THEY WILL PAY FOR IT")
06    game.StarterGui.PizzaGui.Enabled = true
07    wait(1)
08    game.StarterGui.PizzaGui.PizzaMessage.Text = "Mhmm.. This pizza tastes good!"
09    wait(4)
10    game.StarterGui.PizzaGui.PizzaMessage.Text = "Uhm.. why do i hear boss music?"
11 
12    game.StarterGui.PizzaGui.Enabled = false
13    wait(4)
14    game.StarterGui.DiedScreen.Enabled = true
15    game.StarterGui.DiedScreen.Front.DeadMessage.Text = "YOU DIED"
16    wait(3)
17    game.StarterGui.DiedScreen.Front.DeadMessage.Text = "you should have not ate that pizza.."
18end)

btw im a beginner scripter :D

0
Use playergui. Here's the link [https://developer.roblox.com/en-us/api-reference/class/PlayerGui ] JesseSong 3916 — 4y

3 answers

Log in to vote
1
Answered by 4 years ago

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:

1script.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

1script.Parent.ClickDetector.MouseClick:Connect(function() --This line has been edited
2    script.Parent.Parent.SoundEmmiter.YumYum:Play()
3    print("Somebody ate Altera's pizza!")
4    wait(3)
5    print("NOW THEY WILL PAY FOR IT")
6    plr.PlayerGui.PizzaGui.Enabled = true --This line has been edited
7    wait(1)
8    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 :)

0
thanks! it works fine now NexterDev 13 — 4y
0
That's great! Good luck with your future scripts :) Amanda314159 291 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

Hey! Use 'game.StarterGui.PizzaGui.Visible = true' Instead. I hope i was able to help!

0
it says 'Visible is not a valid member of ScreenGui "StarterGui.PizzaGui" NexterDev 13 — 4y
0
Everything else seems proper. sorry for taking your time TheEagle722 170 — 4y
Log in to vote
0
Answered by 4 years ago

To fix the screen gui, you would have to use PlayerGui which is located in game.Players.

01script.Parent.ClickDetector.MouseClick:Connect(function(Click)
02    local Player = game.Players:GetPlayerFromCharacter(Click) --gets the player
03    script.Parent.Parent.SoundEmmiter.YumYum:Play()
04    print("Somebody ate Altera's pizza!")
05    wait(3)
06    print("NOW THEY WILL PAY FOR IT")
07    Player.PlayerGui.PizzaGui.Enabled = true
08    wait(1)
09    Player.PlayerGui.PizzaGui.PizzaMessage.Text = "Mhmm.. This pizza tastes good!"
10    wait(4)
11    Player.PlayerGui.PizzaGui.PizzaMessage.Text = "Uhm.. why do i hear boss music?"
12 
13    Player.PlayerGui.PizzaGui.Enabled = false
14    wait(4)
15    Player.PlayerGui.DiedScreen.Enabled = true
16    Player.PlayerGui.DiedScreen.Front.DeadMessage.Text = "YOU DIED"
17    wait(3)
18    Player.PlayerGui.DiedScreen.Front.DeadMessage.Text = "you should have not ate that pizza.."
19end)

Answer this question