I wanted to make some basic sword or stuff like that,but for some reason it doesnt get the humanoid/Right Arm or stuff like that,heres the script:
local Tool = script.Parent
local Animation = Tool:WaitForChild("Swing")
print("Got the anim")
local Handle = Tool.yes
local debounce = false
Tool.Equipped:Connect(function()
local char = Tool.Parent
local Humanoid = char:WaitForChild("Humanoid") -- Doesnt get the humanoid?
print("Got the humanoid")
local RightArm = char:WaitForChild("Right Arm") -- The game is set to R6
local Weld = Instance.new("WeldConstraint")
print("Made the weld")
Weld.Part0 = RightArm
Weld.Part1 = Handle
Weld.Parent = Handle
Weld.Name = "HandWeld"
Tool.Activated:Connect(function()
local Swing = Humanoid:LoadAnimation(Animation)
Swing:Play()
print("Played the anim") -- Does print that
Handle.Touched:Connect(function(hit)
if hit.Parent.Name ~= Humanoid.Parent.Name then
if hit.Parent:WaitForChild("Humanoid") then
if debounce ~= true and Swing.Playing == true then
debounce = true
hit.Parent:WaitForChild("Humanoid"):TakeDamage(10)
task.wait(3)
debounce = false
else
end
end
end
end)
end)
Tool.Unequipped:Connect(function()
Weld:Destroy()
end)
end)
How can i make it get the humanoid & other stuff from a character?
Thanks in advance.