This script is inside an brick, how do I make this work when you click the brick?
local Cooldown = false script.Parent.RemoteEvent.OnServerEvent:Connect(function(Player) if Cooldown == true then return end if Player:IsInGroup(script.Parent.IsRestricted.Value) then if not Player.PlayerGui:FindFirstChild('NYPDBookPlayer') then if Player.Backpack:FindFirstChild('Grab') then if Player.Backpack.Grab.Suspect.Value then if game.Players:FindFirstChild(Player.Backpack.Grab.Suspect.Value) then local Gui = game.ServerStorage.NYPDBookPlayer:Clone() Gui.Parent = Player.PlayerGui Gui.Suspect.Value = game.Players:FindFirstChild(Player.Backpack.Grab.Suspect.Value) end end end end end Cooldown = false end)
First thing first you need to add click detector inside the brick, and then you can use this script inside the brick. Here is the reference
local brick = script.Parent -- your brick local click = brick.ClickDetector -- the clickdetector click.MouseClick:Connect(function() --When you click the brick then --Do what you want here end)
i think this is the right code
local Cooldown = false local brick = script.Parent -- your brick local click = brick.ClickDetector -- the clickdetector click.MouseClick:Connect(function(Player) if Cooldown == true then return end if Player:IsInGroup(script.Parent.IsRestricted.Value) then if not Player.PlayerGui:FindFirstChild('NYPDBookPlayer') then if Player.Backpack:FindFirstChild('Grab') then if Player.Backpack.Grab.Suspect.Value then if game.Players:FindFirstChild(Player.Backpack.Grab.Suspect.Value) then local Gui = game.ServerStorage.NYPDBookPlayer:Clone() Gui.Parent = Player.PlayerGui Gui.Suspect.Value = game.Players:FindFirstChild(Player.Backpack.Grab.Suspect.Value) end end end end end Cooldown = false end)
as i see here, you have a thing with remote event and i dont know where the fireserver(). So if you need to make a click detector inside a brick then you only need to do like i said earlier Let me know if it helps