Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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?

2 comments

0

Can you add the script that actually plays the sound, because that might be a problem.

0

Yea I can add the script

1 answer

✓ Accepted answer

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

local torso = script.Parent:FindFirstChild("Torso")

1 comment

0

Ok, I tried that but it still didn't work :(

This discussion is preserved as it was. New answers, comments, and votes are closed.