Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My jumping sound script isn't playing the sound when it jumps, any ideas on what is the problem?

Asked by 7 years ago

The Sound script was already in starterplayer when you go into studio and when I try to edit it and put the sounds ids into the line of code and test it, it doesn't work. Any help?

function CreateNewSound(name, id, looped, pitch, parent)
    local sound = Instance.new("Sound")
    sound.SoundId = id
    sound.Name = name
    sound.archivable = false
    sound.Parent = parent
    sound.Pitch = pitch
    sound.Looped = looped

    sound.MinDistance = 5
    sound.MaxDistance = 150
    sound.Volume = 0.65

    return sound
end

local head = script.Parent:FindFirstChild("Head")
if head == nil then
    error("Sound script parent has no child Head.")
    return
end


CreateNewSound("GettingUp",     "rbxasset://sounds/action_get_up.mp3",                  false,  1,      head)
CreateNewSound("Died",      "rbxasset://sounds/uuhhh.mp3",                          false,  1,      head) 
CreateNewSound("FreeFalling",   "rbxasset://sounds/action_falling.mp3",             true,   1,      head)
CreateNewSound("Jumping",       "rbxasset://sounds/187137470.mp3",                  true,   1,       torso)
CreateNewSound("Landing",       "rbxasset://sounds/action_jump_land.mp3",               false,  1,      head)
CreateNewSound("Splash",        "rbxasset://sounds/impact_water.mp3",                   false,  1,      head)
CreateNewSound("Running",       "rbxasset://sounds/action_footsteps_plastic.mp3",       true,   1.85,   head)
CreateNewSound("Swimming",  "rbxasset://sounds/action_swim.mp3",                    true,   1.6,    head)
CreateNewSound("Climbing",  "rbxasset://sounds/action_footsteps_plastic.mp3",       true,   1,      head)

as you see I made the "jumping" sound id to one of my sound ids and it is not working any suggestions?

0
Can you add the script that actually plays the sound, because that might be a problem. hokaijokailakamonza 18 — 7y
0
Yea I can add the script FPSStudioDidi 1 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

You tried to Parent the sound in the torso when you didn't identify the value torso.

local torso = script.Parent:FindFirstChild("Torso")
0
Ok, I tried that but it still didn't work :( FPSStudioDidi 1 — 7y
Ad

Answer this question