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

A script that play a music in a game?

Asked by 3 years ago

So I made a GUI and put this script in it.

local okbutton = script.Parent.TextButton

function onClicked(id)
    id = script.Parent.TextBox.Text
    local music1 = Instance.new("Sound")

    music1.Parent = game.Workspace

    music1.SoundId = "http://www.roblox.com/asset/?id="..id

    wait(1)
    music1:Play()
end

script.Parent.TextButton.MouseButton1Click:Connect(onClicked)

Well, it's not working. Can somebody help me fix this?

1 answer

Log in to vote
0
Answered by 3 years ago

I tested my script out and I found out that it works!

local okbutton = script.Parent.TextButton
okbutton.MouseButton1Click:Connect(function()
    local id = script.Parent.TextBox.Text
    local music1 = Instance.new("Sound")

    music1.Parent = game.Workspace

    music1.SoundId = "rbxassetid://"..id

    wait(1)
    music1:Play()
end)
0
You just had to change your music1.SoundId to "rbxassetid://" instead of "http://www.roblox.com/asset/?id=" FilipinoWrld 22 — 3y
0
Hi there! Mimas18Hun 0 — 3y
0
Yes it's working, but i want to make it like the music plays in the whole server using RemoteEvent. I accidentally posted this question 2 times can you check the script what i wrote here? I would be very grateful. https://scriptinghelpers.org/questions/124882/a-script-that-play-a-music-in-a-game Mimas18Hun 0 — 3y
Ad

Answer this question