Tool firing multiple times

Oooh 1 second! Maybe try to seperate functions?

I have questions:
1- Is the ToolPart the tool itself?
2- Is Script under each tool or StarterPlayerScripts?

  1. the toolpart is the tool, yes
  2. the script is under starter gear (the one that manages all the tools)

Hmm Then I’ll try something

Charssssssss

Try this, if it doesn’t work, ill recommend you putting the script under the tools itself and work it for each tool.

it seems like setupTool Spams after 1st tool.
So if it disappear together with the tool itself when thrown it would be better i guess

local players = game:GetService("Players")
local plr = players.LocalPlayer
local character = plr.Character

character.ChildAdded:Connect(function(child)
	if child:IsA("Tool") then
		child:AddTag("EquippedTool")

		-- Add your setup code here for the tool
		local toolPart = child

		toolPart.Equipped:Connect(function()
			idleAnimationTrack:Play()
		end)

		toolPart.Unequipped:Connect(function()
			idleAnimationTrack:Stop()
			return warn("tool unequipped")
		end)

		local mouse = game.Players.LocalPlayer:GetMouse()

		mouse.Button1Down:Connect(function()
			if toolPart.Parent == character then
				if not thrown then
					thrown = true
					throwbeginAnimationTrack:Play()
				end
			end
		end)

		mouse.Button1Up:Connect(function()
			if toolPart.Parent == character then
				if thrown then
					if not throwAnimationTrack.IsPlaying then
						throwAnimationTrack:Play()
						throwbeginAnimationTrack:Stop()
					end
				end
			end
		end)

		throwAnimationTrack:GetMarkerReachedSignal("Throw"):Connect(function()
			thrown = false
			throwEvent:FireServer(mouse.Hit.Position, toolPart.Handle:FindFirstChild("FirePoint"), toolPart.Damage.Value, finalSpeed, toolPart.Handle, toolPart.Handle.Throw)
			throwAnimationTrack:Stop()
		end)
	end
end)

nope :frowning: , still doesnt work, seems like the only solution is to make separate scripts

Well i guess you have to make it under tools itself in a different way

Well you can also put the scripts in a folder and make when tools in backpack clone that script under tool then destroy itself, so you can edit them under another folder while you don’t change anything in the tool itself

but I would recommend making them under tool itself

1 Like

Wait!!! that’s so smart! thanks so much for helping!:smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.