So I have this code that only runs if the sword is equipped but it doesnt seem to sense if the sword is in hand. Help?
local UIS = game:GetService('UserInputService') local plr = game.Players.LocalPlayer local Char = plr.Character local BlockAnim = script:WaitForChild('BlockAnim') local Keydown = false local Hum = Char.Humanoid local Anim = Hum:LoadAnimation(BlockAnim) local tool = game.StarterPack.ClassicSword local ToolEquip = false tool.Equipped:Connect(function() ToolEquip = true end) tool.Unequipped:Connect(function() ToolEquip = false end) UIS.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.Q then Keydown = true end while Keydown == true and ToolEquip == true do wait(.1) Anim:Play() end end) UIS.InputEnded:Connect(function(input) if input.KeyCode == Enum.KeyCode.Q then Keydown = false end while Keydown == false do wait(.1) Anim:Stop() end end)
this is was all in a local script and is inside of starter character scripts
It's probably because you accessing the tool through starterpack. You should just make the local script a child of the tool and change Char to
local Char = plr.Character or plr.CharacterAdded:Wait()
put the script inside the tool and do the same thing with the guy who helped you