script.Parent.ClickDetector.MouseClick:connect(function(p) local Torso = game.Players.LocalPlayer.Character:WaitForChild("Torso") Torso.Anchored = true if p.Backpack:findFirstChild("Fish") then p.Backpack:findFirstChild("Fish").Handle.Mesh.VertexColor = Vector3.new(0.4,0.4,0.4) wait(2) Torso.Anchored = false end end)
script.Parent.ClickDetector.MouseClick:connect(function(p) local Torso = p.Character:WaitForChild("Torso") Torso.Anchored = true if p.Backpack:findFirstChild("Fish") then p.Backpack:findFirstChild("Fish").Handle.Mesh.VertexColor = Vector3.new(0.4,0.4,0.4) wait(2) Torso.Anchored = false end end)
I'm not sure why you were trying to use LocalPlayer when MouseClick returns the player?
When the MouseClick event is fired, it gives the player who clicked as an argument, in this case 'p.'
Try this.
script.Parent.ClickDetector.MouseClick:connect(function(p) if p.Character then -- Checks if the players character isn't nil local torso = p.Character:FindFirstChild("Torso") local fish = p.Backpack:FindFirstChild("Fish") if torso then -- if torso exists torso.Anchored = true if fish then -- if fish exists p.Backpack.Fish.Handle.Mesh.VertexColor = Vector3.new(0.4,0.4,0.4) wait(2) end torso.Anchored = false end end end)