Hey, guys. I'm trying to make a gui appear on the screen when you click on a part. I've already achieved doing this using a Click Detector inside the part, but I was wondering how you would accomplish this using Suface Gui. This is what I tried doing so far:
script.Parent.MouseButton1Click:connect(function(Player)
local part = script.Parent.Parent.Parent
local gui = part:FindFirstChild("ScreenGui")
part.BrickColor = BrickColor.new("Really red")
if gui then
local newgui = gui:Clone()
newgui.Parent = Player.PlayerGui
end
wait(1)
part.BrickColor = BrickColor.new("Dark stone grey")
end)
As you can see, the color of the brick changes red as expected (line 4), but the gui doesn't clone (line 7). I'm having trouble figuring out how I would locate the player that clicked the part, and I would gladly appreciate anyone how could help me solve this problem.

1 comment
MouseButton1Click does not return player.