So If You Want It To Do It For The Client Only Then Do This:
- Make A Local Script
- Put The Local Script Inside Of The Tool
- Put This Inside Of The Local Script
local tool = script.Parent
local songid = 0
tool.Activated:Connect(function()
local sound = Instance.new("Sound")
sound.Parent = tool
sound.SoundId = "rbxassetid://"..songid
sound:Play()
wait(sound.TimeLength)
sound:remove()
end)
- Change songid To The Numbers Of The Song (Not "rbxassetid://0"!)
If You Want it To Play On The Server Side Its A Bit Harder
- Make A Local Script
- Put The Local Script Inside Of The Tool
- Put This Inside Of The Local Script
local tool = script.Parent
local songid = 0
tool.Activated:Connect(function()
game.ReplicatedStorage.SoundServer:FireServer(songid)
end)
- Change songid To The Numbers Of The Song (Not "rbxassetid://0"!)
- Make A Script
-. Put The Script Inside Of ServerScriptService Or Workspace
- Put This Inside Of The Script
game.ReplicatedStorage.SoundServer.OnServerEvent:Connect(function(player,songid)
local sound = Instance.new("Sound")
sound.Parent = workspace
sound.SoundId = "rbxassetid://"..songid
sound:Play()
wait(sound.TimeLength)
sound:remove()
end)
- Now Finally Put A Remote Event In Replicated Storage And Name It: SoundServer
- Enjoy
If You Have Any problems Feel Free To Contact Me On Discord: Harry_TheKing1#2303
2 comments
Would you mind putting it into a codeblock?
Try adding a wait() for however long the song is.