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 4 years ago
Edited 4 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)

local ClickDetector = script.Parent.ClickDetector
local ogien1 = script.Parent.Parent.ogienjeden.Fire
local ogien2 = script.Parent.Parent.ogiendwa.Fire
local ogien3 = script.Parent.Parent.ogientrzy.Fire
local ogien4 = script.Parent.Parent.ogiencztery.Fire
local tekst = game.StarterGui.ScreenGui.Frame.TextLabel
local ramka = game.StarterGui.ScreenGui.Frame

ClickDetector.MouseClick:connect(function()
   ogien1.Enabled = true
   ogien2.Enabled = true
   ogien3.Enabled = true
   ogien4.Enabled = true
   ramka.Visible = true
   tekst.Text = "Ktos podpalil automat biletowy przy zajezdni Lodygowa. *klap klask*"
   wait(5)
   ramka.Visible = false
   tekst.Text = ""
end)

0
is there any error on the console? type /console in roblox studio when testing game and tell me the error guest_20I8 266 — 4y
0
no, the script isn't throwing any errors Trolek78 52 — 4y

1 answer

Log in to vote
1
Answered by
Nanomatics 1160 Moderation Voter
4 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:

local ClickDetector = script.Parent.ClickDetector
local ogien1 = script.Parent.Parent.ogienjeden.Fire
local ogien2 = script.Parent.Parent.ogiendwa.Fire
local ogien3 = script.Parent.Parent.ogientrzy.Fire
local ogien4 = script.Parent.Parent.ogiencztery.Fire

ClickDetector.MouseClick:connect(function(plr) -- player that clicked
   ogien1.Enabled = true
   ogien2.Enabled = true
   ogien3.Enabled = true
   ogien4.Enabled = true
   local ramka = plr.PlayerGui.ScreenGui.Frame -- new
   local tekst = ramka.TextLabel -- new

   ramka.Visible = true
   tekst.Text = "Ktos podpalil automat biletowy przy zajezdni Lodygowa. *klap klask*"
   wait(5)
   ramka.Visible = false
   tekst.Text = ""
end)

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