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)
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)
#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)
Nice answer, Incapaz
Thanks man!
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
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.