local part = script.Parent
local click = part:WaitForChild("ClickDetector")
local click = script.Parent.ClickDetector
click.MouseClick:Connect(function(click)
local h = click.Parent:FindFirstChild("Humanoid")
local plyr = game.Players:FindFirstChild(h.Perant.Name)
local p = game.Players:FindFirstChild(plyr.PlayerGui.scGUI)
p.Enabled = true
end)
local part = script.Parent
local click = part:WaitForChild("ClickDetector")
--[[ local click = script.Parent.ClickDetector
^ this line isn't necessary, you already defined it at line 2 ]]
click.MouseClick:Connect(function(player) -- change the parameter name to something other than "click" to not cause confusion between the variable and the argument
--[[
local h = click.Parent:FindFirstChild("Humanoid")
local plyr = game.Players:FindFirstChild(h.Perant.Name) <- you also misspelled "Parent"
local p = game.Players:FindFirstChild(plyr.PlayerGui.scGUI)
the parameter already sends the player who clicked it, you don't need to do anything fancy
to get the player ]]
local gui = player.PlayerGui.scGUI
gui.Enabled = true
end)
Well, being unaware I can only assume on what you’re trying to achieve. I hope this helps though: script.Parent.MouseClick:Connect(function(player)
player.PlayerGui:FindFirstChild(“scGUI”).Enabled = true
end)
Also, click should be replaced with something that resembles the player. When it is clicked the parameter is what clicked it, which is the player. And the player does not contain a Humanoid. Instead it would be player.Character.Humanoid
local part = script.Parent
local click = part:WaitForChild('ClickDetector')
click.MouseClick:Connect(function(player)
player.PlayerGui.scGui.Enabled = true
end)
If it’s being closed by a gui it will not work, because you’re making it visible on the server you need to close it on the server. This can be done with a remote event.