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

onClicked GUI Not Appearing?

Asked by 6 years ago

Hello! So here is something that I made that when the brick is clicked, a GUI becomes visible but when I click it, it doesn't appear and nothing appears in the output logs.

function onClicked()
    game.StarterGui.StoreGUI.ShabbyMall.ScreenGui.Background.Visible = true
end

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

I did this to the script to check if it works. It does.

function onClicked()
    game.Workspace.Baseplate:Destroy()
end

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

So what am I doing wrong in the first script? And this is not FE.

1 answer

Log in to vote
0
Answered by 6 years ago

You needed to show the hierarchy for us to easily understand the problem and fix it Btw connect is deprecated, use Connect

function onClicked(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
   if hit and hit.Parent and player then
        player.PlayerGui.StoreGUI.ShabbyMall.ScreenGui.Background.Visible = true -- Check if Visible is in the properties
    else
        print("Nil")
    end
end

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

Please submit this answer if this helped

0
I inserted this but the output says nil BunnyFilms1 297 — 6y
0
hmm that makes hit nil then saSlol2436 716 — 6y
0
You needed a hierarchy to show us what each object is from saSlol2436 716 — 6y
Ad

Answer this question