Okay, so let’s get straight into it. I’m not very good at coding, and only just started. I’ve looked at documentations and other forums to find out how to make sound when a marker is met.
I don’t want to adjust the speed of the animation, but the footsteps that is out of sync annoys me!
I’m using R6, and I am also using the default Animate script that roblox players spawn with in-game.
I’ve tried to do the script with examples, but this is as far as I could get, with it leading to an error.
local Humanoid = script.parent.Humanoid
function playFootstepSound()
local anim = Humanoid:LoadAnimation(script.Parent.Animate.walk.WalkAnim)
print("Sound played!")
end
local onStep = GetMarkerReachedSignal('foothit')
onStep:Connect(playFootstepSound)
I get an error "Workspace.Ssandst0rm.footsteps:8: attempt to call a nil value in the output.
I’ve been stuck on this for a while now, so any help is very much appreciated.
hmm, took a look at what you said and changed it around! The function no longer exists, but the print works and the output no longer says the Marker is me calling a nil value!
Tricky part now is that the sound only plays once, and it doesn’t even matter if im walking or not! Tricky indeed.
local Humanoid = script.parent.Humanoid
anim = Humanoid:LoadAnimation(script.Parent.Animate.walk.WalkAnim)
if anim:GetMarkerReachedSignal("foothit") then
script.Walk:Play()
print("Sound played!")
end