Equipped event doesn't fire

Hi, I’m making a survival game. and I’m making a crafting menu, but when I equip the tool it doesn’t print what I want to. also I clone the tool from ReplicatedStorage to player’s backpack, and after parenting it to the backpack, it doesn’t print (“Equiped”) but if I put the same tool in StarterPack and equip it, then it will print. I have no idea why it’s happening

Its literally impossible for us to help you with your issue if you dont show the code that is not working.

I’ll show you the code:



local Player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()

local MouseSmall = Player:GetMouse()

local Character = Player.CharacterAdded:Wait()

Player.CharacterAdded:Connect(function()
	print("character added")
end)

local HRP = Character:WaitForChild("HumanoidRootPart")

local Cutting = script:WaitForChild("Cutting")

local tree

local tweener

local Humanoid = Character:WaitForChild("Humanoid")

Humanoid.Died:Connect(function()
	print("died")
	Character = Player.CharacterAdded:Wait()
end)



script.Parent.Equipped:Connect(function(Mouse)
	print("Equiped!")

	Mouse.Button1Up:Connect(function()
		if Mouse.Target then
			print("Target found!")
		end
		
		
		
		if Mouse.Target:FindFirstChild("Pickable") and Mouse.Target.Parent:FindFirstChild("Life").Value ~= 0 and (HRP.Position - Mouse.Target.Position).magnitude < 15 then
			print("Decrease")
			
				game.ReplicatedStorage.Break:InvokeServer(Mouse.Target.Parent, 2)
			
				Humanoid:LoadAnimation(Cutting):Play()
			
				 tree = Player.PlayerGui:FindFirstChild("Tree").Oak
				 tweener = tree.Health
				
				local clamp = math.clamp(Mouse.Target.Parent:FindFirstChild("Life").Value / 5, 0, 1)
				
				tweener:TweenSize(UDim2.new(clamp, 0, 1,0), "InOut", "Linear", 0.5)
				tweener.Text = Mouse.Target.Parent:FindFirstChild("Life").Value
				
			    tree.Visible = true
				
				
				
				
				if Mouse.Target.Parent.Life.Value == 0 then
					tweener:TweenSize(UDim2.new(1,0,1,0), "InOut", "Linear", 0.01)
					tree.Visible = false
					
				end
			end	
	end)
end)


	while wait() do
	if MouseSmall.Target and MouseSmall.Target.Parent:FindFirstChild("Life") and MouseSmall.Target.Parent.Life.Value == 0 and MouseSmall.Target:FindFirstChild("Pickable") then
		game.Workspace.Pick.Adornee = MouseSmall.Target
		game.Workspace.Pick.Enabled = true
	elseif MouseSmall.Target and MouseSmall.Target:FindFirstChild("Broke") then
		game.Workspace.Pick.Adornee = MouseSmall.Target
		game.Workspace.Pick.Enabled = true
	else
		game.Workspace.Pick.Adornee = nil
		game.Workspace.Pick.Enabled = false
	end
end

If I put this tool in starter pack and then test it, it’s gonna work else if I clone it and parent it to player’s backpack then it’s not gonna work.

Basically, this one will wait until a character is assigned to a player. The script will ignore the fact that there already is a character and will wait until a character is assigned anyway, yielding the script indefinitely. So a fix would be to see if the character exists already, and if not wait until it is assigned.

local Character = Player.Character or Player.CharacterAdded:Wait()
1 Like

Yeah, Thanks I’ll do it, thanks again

Remember to mark a post as a solution if it solved your problem.