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

Music via PlayerChatted..?

So I currently have a script which plays music on spawn, it goes like this:

`while true do

Game.Workspace.Script.Music1:play() wait(60) Game.Workspace.Script.Music1:stop() end`

I was wondering if anyone knows how to script it so a player chats 'play/RobloxThemeTune' or something like that, then they could say 'stop' or 'pause', but it would only effect what they're listening to, not other players.

Thanks -iFluster

1 answer

✓ Accepted answer

First off, to play music locally you could do something like this (LocalScript):

player=Game.Players.LocalPlayer
music=Instance.new("Sound",player)
music.SoundId=0 --Your ID here
music.Name='Music'

Secondly, you could do something like this (Script):

Game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg)
if msg:lower()=='play' then
player:WaitForChild("PlayerGui"):WaitForChild("Music"):Play()
end
end)
end)

This will make it so that when the player chats 'play' it will play the music that you inserted into the player's PlayerGui and only play the music for that one player.

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