im using clickdetector inside brick, it has a normal script inside:
script.Parent.ClickDetector.MouseClick:Connect(function(p) if p.Character.Masked.Value == true then if p.Character.Bag.Value == false then print("Stolen") --give bag to character p.Character.Bag.Value = true script.Parent.Parent:Destroy() elseif p.Character.Bag.Value == true then p.PlayerGui.bagwarning.Enabled = true wait(1) p.PlayerGui.bagwarning.Enabled = false end end end)
i also tried
script.Parent.ClickDetector.MouseClick:Connect(function(p) if p.Character.Masked.Value == true then if p.Character.Bag.Value == false then print("Stolen") --give bag to character p.Character.Bag.Value = true script.Parent.Parent:Destroy() elseif p.Character.Bag.Value == true then p.PlayerGui["bagwarning"].Enabled = true wait(1) p.PlayerGui["bagwarning"].Enabled = false end end end)
and supposedly the (p) is the player that clicks it which is me, and i even CHECKED for that screen gui, the name IS correct, but it doesnt work and output says:
bagwarning is not a valid member of PlayerGui
please help :()
From what I know, a normal script can't access the playergui due to filtering enabled. You would have to use a remote event, from the server to the client, to disable/enable the GUI. https://developer.roblox.com/articles/Remote-Functions-and-Events
Or, you could also simply change the script to a local script. That should fix it, unless there is an error elsewhere.