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

Gui Will Not Become Visible, Please Help, What Am I Doing Wrong Here?

Asked by 6 years ago

My Gui isn't becoming visible and I don't understand why!

Brick = script.Parent
Brick.Touched:connect(function()
    game.StarterGui.TT.Frame.Visible = true
    script.Parent.Transparency = 1
    game.Workspace.TLine.Transparency = 0.5
end)


0
StarterGui.TT is not the frame you are looking for. You need to catch the player who stepped on your brick, and access their PlayerGui. SummerEquinox 643 — 6y

1 answer

Log in to vote
3
Answered by 6 years ago

StarterGui and PlayerGui; Not the Same

Some beginners may find this to be a quick way to change a Gui for all players. Unfortunately, it's not that simple. StarterGui is basically what PlayerGui clones from when you respawn. That means, any changes you make to objects in StarterGui will not show until you respawn.

So what you were doing was changing the visibility of the GUI in StarterGui, not the players GUI.

You should handle the Touched event on the client, and check if it's them who touched it. Place the LocalScript somewhere where local scripts will execute in, like PlayerScripts.

local Brick = game.Workspace.Part -- whatever your part's name is
local client = game:GetService("Players").LocalPlayer

Brick.Touched:Connect(function(part) -- :connect is deprecated, use :Connect
    if part:IsDescendantOf(client.Character) then -- if *they* touched it
        client.PlayerGui.TT.Frame.Visible = true -- Getting GUI from their PlayerGui!
        Brick.Transparency = 1
        game.Workspace.TLine.Transparency = 0.5
    end
end)

source

3
Nice answer, Incapaz Leamir 3138 — 6y
1
Thanks man! Darkcraft10 20 — 6y
Ad

Answer this question