Hello, this script was made for arrest system, however when I am clicking on it nothing happens and console says "Attempt to index nil with PlayerGui" This is the script:
script.Parent.ClickDetector.MouseClick:Connect(function(plr) local Gui = game.ServerStorage.NYPDBookPlayer:Clone() Gui.Parent = Player.PlayerGui Gui.Suspect.Value = game.Players:FindFirstChild(Player.Backpack.Grab.Suspect.Value) end)
You're putting "Player" instead of "plr", where you defined it. Your code would instead be
script.Parent.ClickDetector.MouseClick:Connect(function(Player) local PlayerGui = Player:WaitForChild("PlayerGui") local Suspect = game.Players:FindFirstChild(Player.Backpack.Grab.Suspect.Value) if Suspect then local Gui = game.ServerStorage.NYPDBookPlayer:Clone() Gui.Parent = Player Gui.Suspect.Value = Suspect end end)