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.

01local okbutton = script.Parent.TextButton
02 
03function onClicked(id)
04    id = script.Parent.TextBox.Text
05    local music1 = Instance.new("Sound")
06 
07    music1.Parent = game.Workspace
08 
09    music1.SoundId = "http://www.roblox.com/asset/?id="..id
10 
11    wait(1)
12    music1:Play()
13end
14 
15script.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!

01local okbutton = script.Parent.TextButton
02okbutton.MouseButton1Click:Connect(function()
03    local id = script.Parent.TextBox.Text
04    local music1 = Instance.new("Sound")
05 
06    music1.Parent = game.Workspace
07 
08    music1.SoundId = "rbxassetid://"..id
09 
10    wait(1)
11    music1:Play()
12end)
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