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

Why doesn't it work?!?

So if i put my intro music into the starter gui it always plays when you die/reset i've made this clone script only plays the music when you enter the game and never again.

local Sound = script.Sound:Clone()
game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:wait()
	Sound:Clone().Parent = player.PlayerGui
	wait(.1)
	Sound:Play().Parent = player.PlayerGui
end)

The thing i want is: Let it clone to playergui which works, but doesn't play the sound. So the prob is i want to make it play when it clones the sound. Help pls...

2 answers

✓ Accepted answer

Well, I believe sound only plays in two places: The Player & The Workspace. Sounds don't work in other places like the PlayerGui.

Workspace: Plays Sound For Everyone

player.Sound:Play()

The Player: Plays sound for ONE person only.

workspace.Sound:Play()

Maybe you want to do this, instead of putting the sound in the GUI, put it in the player.

local Sound = script.Sound:Clone()
game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:wait()
    Sound:Clone().Parent = player
    wait(.1)
    Sound:Play().Parent = playeri
end)

2 comments

0

Thank youuuu :3

0

No Problem! Make sure to leave an upvote :3

Your problem is that you have incorrect syntax.

Sound:Play().Parent is not correct syntax.

I'm assuming what you want to happen is that the sound is cloned into the playergui and then the sound plays after 0.1 seconds. I would suggest setting the clone of the sound to a local variable, and then setting that variable's parent to the playergui, and then after 0.1 seconds make the variable play, like so:

local soundClone = Sound:Clone()
soundClone.Parent = player.PlayerGui
wait(0.1)
soundClone:Play()

Hope this helped!

1 comment

0

http://prntscr.com/879o1a This is how it looks, it doesn't even clone the sound to PlayerGui doesn't work :/

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