Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

when i equip the tool and press Q nothing happens, what should I do?

--Varables
local Form1 = script:WaitForChild("FirstForm")
local equipped = false
local UIS = game:GetService("UserInputService")
local tool = game.StarterPack.Sword


--Animate
tool.Equipped:Connect(function()
	equipped = true
end)

tool.Unequipped:Connect(function()
	equipped = false
end)

UIS.InputBegan:Connect(function(Input, isChatting)
	if isChatting then return end
	if Input.KeyCode == Enum.KeyCode.Q and equipped == true then

		local Humanoid = tool.Parent:WaitForChild("Humanoid")
		local AnimTrack = Humanoid:LoadAnimation(Form1)

		AnimTrack:Play()
	end
end)

1 answer

✓ Accepted answer

You defined tool as the sword in StarterPack. Instead, define tool as the sword the player is holding.

Change line 5 to this assuming that the script is parented to the tool

local tool = script.Parent

1 comment

0

uhm the script is in starter player

This discussion is preserved as it was. New answers, comments, and votes are closed.