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

Help with playing music localy on touched local script? (UNSOLVED)

Asked by
Admin8483 -21
7 years ago
Edited 7 years ago

I am making a new speed run, and I need it to play this audio in PlayerGui. The audio is I it, and the only problem is something about the OnTouched part (Not shown in Output, just a guess). (This is a LocalScript)

script.Parent.OnTouched:connect(function(hit, player)
    local songs = game.Players.LocalPlayer.PlayerGui.Music
songs.Level1:Stop()
songs.Level1:Play()
end)

Thanks in advance!

0
Have you looked in output if there is a error? ChristianSenpaii 29 — 7y
0
^^^ There is an error (he just said it). What is the error that is "something about the OnTouched part." You can see it at output in view. WHITEHH 0 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago
script.Parent.Touched:connect(function(hit, player)
    local songs = game.Players.LocalPlayer.PlayerGui.Music
    songs.Level1:Stop()
    songs.Level1:Play()
end)

Fixed, for you. You put 'OnTouched', when the event is supposed to be 'Touched'.

0
Thanks so much! I just realized that I needed to put this in a server script. Admin8483 -21 — 7y
0
No problem, but putting it in a server script will make it play globally (everyone in the server will hear it). To make it work in a local script, I recommend removing the variables 'hit' and 'player' on line 1. I would also appreciate if you accepted the answer so that this thread closes. :) Wilbob30 69 — 7y
0
Thanks! I'll try it. Admin8483 -21 — 7y
0
It doesnt work in a local script Admin8483 -21 — 7y
Ad

Answer this question