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

Brick that gives you GUI when you click on it doesn't work. Why?

I made button brick, when you click on it, it shows a Selection Box and a GUI. But for some reason it doesn't work. This is my script;

local gui = script.Gui:clone()

function onClicked(Part)
	if not Player.PlayerGui:FindFirstChild("Gui") then
		gui.Parent = Player.PlayerGui
		gui.LocalScript.Disabled = false
	end
		script.Parent.SelectionBox.Visible = true
	end
end
	
script.Parent.ClickDetector.MouseClick:connect(onClicked)

What went wrong in this?

1 answer

local gui = script.Gui:clone()

script.Parent.ClickDetector.MouseClick:connect(function(Player)
    if not Player.PlayerGui:FindFirstChild("Gui") then
        gui.Parent = Player.PlayerGui
        gui.LocalScript.Disabled = false
    end
        script.Parent.SelectionBox.Visible = true
    end)

I don't think you were getting the player value... Try this.

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