1

# i wanted to make gui visible by a button it didnt work. Can someone help?

Brick = script.Parent Sound = Brick.Sound

function onClicked() Sound:Play() game.StarterGui.ScreenGui.Frame.Visible = true end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

0
Xapelize 2658
1 year ago

You changed the StarterGui Guis. StarterGui guis are only viewable by server and what we see is PlayerGui. Heres a sample below:

game.Players.Thelodomir_320.PlayerGui.ScreenGui.Frame.Visible = true


To fit in your script, you need to access to PlayerGui. By accessing PlayerGui you need to have the player. You can get player parameter with PlayerAdded event. You can access it with any script.

game:GetService("Players").PlayerAdded:Connect(function(player) -- to get the player parameter
local Brick = script.Parent
local Sound = Brick.Sound

function onClicked()
Sound:Play()
player:WaitForChild("PlayerGui").ScreenGui.Frame.Visible = true
end

Brick.ClickDetector.MouseClick:Connect(onClicked)
end)

0
ooooh Thelodomir_320 5 — 1y
0

Hm. Well I say i have the solution for that.

You did the sound and the playing sound wrong.

Brick = script.Parent.Brick.Sound

local function OnClick()
Brick.Playing = true
game.StarterGui.ScreenGui.Frame.Visible = true
end

script.Parent.ClickDetector.MouseClick:Connect(onClicked)


not

Brick = script.Parent Sound = Brick.Sound

function onClicked()
Sound:Play() game.StarterGui.ScreenGui.Frame.Visible = true
game.StarterGui.ScreenGui.Frame.Visible = true
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)