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

Frame doesn't appear when clicked. Help?

Asked by 5 years ago
Edited 5 years ago

So, i want to make a secret button, that activates fires, and was supposed to display a frame that says someone lit up the thing, that will appear for 5 seconds. After the 5 seconds, it will disappear. And the frame doesn't appear at all.

My code: (its in a normal script, not in a localscript)

01local ClickDetector = script.Parent.ClickDetector
02local ogien1 = script.Parent.Parent.ogienjeden.Fire
03local ogien2 = script.Parent.Parent.ogiendwa.Fire
04local ogien3 = script.Parent.Parent.ogientrzy.Fire
05local ogien4 = script.Parent.Parent.ogiencztery.Fire
06local tekst = game.StarterGui.ScreenGui.Frame.TextLabel
07local ramka = game.StarterGui.ScreenGui.Frame
08 
09ClickDetector.MouseClick:connect(function()
10   ogien1.Enabled = true
11   ogien2.Enabled = true
12   ogien3.Enabled = true
13   ogien4.Enabled = true
14   ramka.Visible = true
15   tekst.Text = "Ktos podpalil automat biletowy przy zajezdni Lodygowa. *klap klask*"
16   wait(5)
17   ramka.Visible = false
18   tekst.Text = ""
19end)
0
is there any error on the console? type /console in roblox studio when testing game and tell me the error guest_20I8 266 — 5y
0
no, the script isn't throwing any errors Trolek78 52 — 5y

1 answer

Log in to vote
1
Answered by
Nanomatics 1160 Moderation Voter
5 years ago

The problem is you're editing the frame in the StarterGui, whenever a player joins a game, all the ScreenGuis in startergui gets cloned to something called "PlayerGui" which is under the player object, so editing the startergui won't show anything on the player, because the player has another ScreenGui.

So what you can do, is:

01local ClickDetector = script.Parent.ClickDetector
02local ogien1 = script.Parent.Parent.ogienjeden.Fire
03local ogien2 = script.Parent.Parent.ogiendwa.Fire
04local ogien3 = script.Parent.Parent.ogientrzy.Fire
05local ogien4 = script.Parent.Parent.ogiencztery.Fire
06 
07ClickDetector.MouseClick:connect(function(plr) -- player that clicked
08   ogien1.Enabled = true
09   ogien2.Enabled = true
10   ogien3.Enabled = true
11   ogien4.Enabled = true
12   local ramka = plr.PlayerGui.ScreenGui.Frame -- new
13   local tekst = ramka.TextLabel -- new
14 
15   ramka.Visible = true
16   tekst.Text = "Ktos podpalil automat biletowy przy zajezdni Lodygowa. *klap klask*"
17   wait(5)
18   ramka.Visible = false
19   tekst.Text = ""
20end)

Now it should work, even though I recommend only editing UIs through localscripts that are under the ScreenGuis, and you can communicate through RemoteEvents from server to client, however that's more advanced but if you want to read about it you can check here

Hope I helped, if you have any questions please let me know!

Ad

Answer this question