Hello everyone!
im having an issue with getting the sound to play inside the monster im making, this code detects his walkspeed and determines rather the sound plays faster or slower or doesnt play at all, anyways…
nothing is playing at all even when he moves, and im not sure what it is, any help?
local Monster = script.Parent.Parent
local function PlayBackVel()
if Monster.Humanoid.WalkSpeed > 16 then
script.stomping.PlaybackSpeed = 1.6
else
script.stomping.PlaybackSpeed = 0.8
end
end
local function StopOrPlay()
if Monster.Humanoid.MoveDirection.Magnitude < 1 then
script.stomping:Pause()
else
script.stomping.Playing = true
end
end
while true do
wait(0.1)
PlayBackVel()
StopOrPlay()
end
Are there any errors in the output? I made a similar script and it worked fine. Ensure your studio volume is up, the sound loaded properly and that the sound volume isn’t 0. Also you might want to sanity check the .Magnitude. Just add a print statement before you call StopOrPlay and print out the magnitude
some info:
The Volume is at 5 for testing purpose,
i have added the print statement and oh wow, it always says the magnitude = 0
even tho he is like moving.
any idea on why?
it worked thank you so much! im gonna leave the code down for anyone who needs help
local Monster = script.Parent.Parent
local function PlayBackVel()
if Monster.Humanoid.WalkSpeed > 16 then
script.Parent.stomping.PlaybackSpeed = 1.6
else
script.Parent.stomping.PlaybackSpeed = 0.8
end
end
local function StopOrPlay()
if script.Parent.Parent.HumanoidRootPart.Velocity.Magnitude < 1 then
script.Parent.stomping:Pause()
else
script.Parent.stomping.Playing = true
end
end
while true do
wait(0.1)
PlayBackVel()
StopOrPlay()
end