Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

onClicked GUI Not Appearing?

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

✓ Accepted answer

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

3 comments

0

I inserted this but the output says nil

0

hmm that makes hit nil then

0

You needed a hierarchy to show us what each object is from

This discussion is preserved as it was. New answers, comments, and votes are closed.