I’d like a dummy in-game to be able to swing a sword (for testing purposes)
I have a sword script for the players, I’ve done what I thought I needed to do to convert it to a dummy script that will work without a player, however, when I play, nothing happens to the dummy, no animations or anything.
Here’s my script for the dummy:
local rs = game:GetService("ReplicatedStorage")
local _M1 = rs.ClientModules.M1
local shootRays = rs.Remotes.ShootRays
local char = script.Parent
local swingCount = 1
local dmg = 20
local swingAnims = {
rs.Anims.Swing1,
rs.Anims.Swing2,
rs.Anims.Swing3,
rs.Anims.Swing4,
rs.Anims.Swing5,
}
while true do
local isFinal = false
if swingCount < 5 then
swingCount += 1
else
swingCount = 1
isFinal = true
end
local humanoid = char:FindFirstChild("Humanoid")
local animator = humanoid.Animator
local swingAnimTrack = animator:LoadAnimation(swingAnims[swingCount])
swingAnimTrack:Play()
repeat wait() until swingAnimTrack.length > 0
delay(swingAnimTrack.length/2.5, function()
shootRays:FireServer(swingAnimTrack.length-swingAnimTrack.length/3.5, char, dmg)
end)
delay(swingAnimTrack.length-0.125, function()
swingAnimTrack:AdjustSpeed(0.5)
end)
local cooldownTime = swingAnimTrack.length-0.15
task.wait(cooldownTime)
end
p.s. It’s a local script.