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

Local music script for one person does not even play music? NOT SOLVED

So I want it to be so that by default specific music plays when a player spawns, and it ONLY plays for that player. It won't work, NO ONE can hear it. I've tried using functions, different scripts, etc, but nothing works! It's in a local script in ScreenGui. Also, this script works when its enabled by pushing a button or something because I have another script like that too. Script:

ButtonBacking = script.Parent:WaitForChild("ButtonBacking")
Player = game.Players.LocalPlayer
BlackScreen = script.Parent:WaitForChild("BlackScreen")
TeleportButton = ButtonBacking:WaitForChild("TeleportButton")
SpawnLabel = script.Parent:WaitForChild("Spawn")

local S1 = ButtonBacking:WaitForChild("Sound")
local S2 = ButtonBacking:WaitForChild("Sound2")
local S3 = ButtonBacking:WaitForChild("Sound3")

S1:Play()

Also, none of the variables are wrong.

Thanks! -Clubberoni

1 answer

There could be several things preventing it from playing. One thing could be that its waiting for something. All the "WaitForChild" could be pausing the script waiting for it to appear. You may want to check spelling on that.

Another thing that could be wrong it maybe you're missing the click event.

local Button2Click = script.Parent.Button2Click
ButtonBacking = script.Parent:WaitForChild("ButtonBacking")
Player = game.Players.LocalPlayer
BlackScreen = script.Parent:WaitForChild("BlackScreen")
TeleportButton = ButtonBacking:WaitForChild("TeleportButton")
SpawnLabel = script.Parent:WaitForChild("Spawn")

local S1 = ButtonBacking:WaitForChild("Sound")
local S2 = ButtonBacking:WaitForChild("Sound2")
local S3 = ButtonBacking:WaitForChild("Sound3")

Button2Click.MouseButton1Click:connect(function()
S1:Play()
end)

You woud change the "Button2Click" Variable to the button you wanted to active the music.

Another thing might be the sound isn't loading or its not the correct ID. Might wanna double check that.

3 comments

0

The sound works, I'm using it in another script too. No button that's supposed to activate it, it's just supposed to be activated when the player dies or joins, I

0

Welp, FindFirstChild won't fix it

0

The music works in studio but not in game

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