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

Can someone help me with Server-Client-Studio Sound Problem?

Asked by 8 years ago

I made a thread recently about my problem, but I have changed how the script works, https://scriptinghelpers.org/questions/26465/help-me-with-sound-working-on-studio-but-not-ingame

My problem is now that the script totally works in studio, but does not work in game.

The script is inside a part that is in workspace (if you need to know that)

I think that the problem comes as the sound is played on the server, but it fails to recognise the sound after the event was triggered (as if the sounds would remove after they were created)

This script was making the sound still play even after the sound instance was removed and even after roblox was closed (In previous version, I do not have the code) (we had to crash roblox (even if we closed it) in order to stop the song)

Here is my script:

print("Loading Music thing")
local List = {
    [1] = "218607791";
    [2] = "218608165";
    [3] = "218609229";
}
local Music = Instance.new("Sound")
Music.Pitch = 1
Music.Volume = 0.1
Music.Looped = false

for i,v in pairs(List) do
    local m = Music:Clone()
    m.Parent = script.Parent
    m.Name = "Player"..i
    m.SoundId = "rbxassetid://"..List[i]
    if i == 1 then
        m:Play()
    end
    m.Ended:connect(function()
        if m.Name == "Player"..#List then
            script.Parent["Player1"]:Play()
        else
            script.Parent["Player"..(i+1)]:Play()
        end
    end)
end

1 answer

Log in to vote
0
Answered by 7 years ago

Hello, I see you have a problem with your script working on roblox studio but not online. To be honest I see this question quite a lot and it has happened to me a lot of the time...

https://scriptinghelpers.org/blog/it-works-in-studio-but-not-online

After reading this link I really understood why my script wouldn't work online, this blog does not only help your problem but it helps many many other situations.

Hopefully this worked out for you.... let me know if it did

Ad

Answer this question