Getting error while running a function

Hello,

So I made a script with a lot of functions in it. But at the function;

tool.Equipped:Connect(function(player, mouse)
   --- code
end)

Im getting this error;

image

This is the full script;




local prox = script.Parent

game.Players.PlayerAdded:Connect(function(player)
	prox.TriggerEnded:Connect(function(player)
		
		
		
		
		
		local ServerStorage = game:GetService("ServerStorage")
		local screen = player.Backpack:FindFirstChild("Tool") or player.Character:FindFirstChild("Tool")
		
		local wireCover = player.Backpack:FindFirstChild("MetalCover") or player.Character:FindFirstChild("MetalCover")
		
		if screen then
			screen.Equipped:Connect(function(player, mouse)
				
				local screen_Clone = ServerStorage.Screen:Clone()
				screen_Clone.Name = "Screen"
				screen_Clone.Parent = game.Workspace.WorkshopGarage.Garage.Workshop.TopPartDesk
				screen_Clone.Position = Vector3.new(575.5, 17.347, -71.25)
				
				screen_Clone.Anchored = true
				
				screen_Clone.Orientation = Vector3.new(0, 70, 90)
					
				local originalScreen = player.Backpack:FindFirstChild("Tool") or player.Character:FindFirstChild("Tool")
				originalScreen:Destroy()
			end)
		end
		
		
		if wireCover then
			wireCover.Equipped:Connect(function(player, mouse)
				
				local metalCoverClone = ServerStorage.MetalCover:Clone()
				metalCoverClone.Name = "WireCover"
				metalCoverClone.Parent = game.Workspace.WorkshopGarage.Garage.Workshop.TopPartDesk
				metalCoverClone.Position = Vector3.new(574.754, 17.318, -73.077)
				metalCoverClone.Orientation = Vector3.new(0, -50, 0)
				
				local originalCover = player.Backpack:FindFirstChild("MetalCover") or player.Character:FindFirstChild("MetalCover")
				originalCover:Destroy()
			end)
		end
	end)
end)
1 Like

first parameter of equipped is “Mouse”
Just remove player parameter in Equipped event and leave the mouse. It will work just fine

As seen in this documentation, Tool.Equipped only returns the Mouse parameter.