Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local new = Instance.new("Sound")
- new.Name = "ServerSound"
- new.Parent = game.Workspace
- local remote = Instance.new("RemoteEvent")
- remote.Name = "SoundTransmitter"
- remote.Parent = game.ReplicatedStorage
- local remote2 = Instance.new("RemoteEvent")
- remote2.Name = "NewMusic"
- remote2.Parent = game.ReplicatedStorage
- for i,v in pairs (game.ServerStorage["Gui + Songs"].Songs:GetChildren()) do
- v.Name = "Music"
- end
- game.ServerStorage["Gui + Songs"].Menu.MainScreen.Controller.Disabled = false
- game.Players.PlayerAdded:connect(function(player)
- player.CharacterAdded:connect(function(character)
- local find = player.PlayerGui:FindFirstChild("Menu")
- if find == nil then
- local clone = game.ServerStorage["Gui + Songs"].Menu:Clone()
- clone.Parent = player.PlayerGui
- end
- end)
- end)
- game.ReplicatedStorage.NewMusic.OnServerEvent:connect(function(Player, MusicId)
- local soundname = game:GetService("MarketplaceService"):GetProductInfo(MusicId)
- print(Player.Name.. " added | ".. soundname.Name.. " | to the music list!")
- local music = Instance.new("IntValue")
- music.Name = Player.Name
- music.Value = MusicId
- music.Parent = game.ServerStorage["Gui + Songs"].Songs
- if music.Value == 0 then
- music:Destroy()
- end
- end)
- --------------------------------Dev Products-------------------------------
- function Location(IdNumber)
- for i,v in pairs (game.Players:GetChildren()) do
- if v.UserId == IdNumber then
- return v
- end
- end
- end
- local MarketplaceService = game:GetService("MarketplaceService")
- local BuyMusic = 55596433
- local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
- function MarketplaceService.ProcessReceipt(receiptInfo)
- local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.PurchaseId
- if PurchaseHistory:GetAsync(playerProductKey) then
- return Enum.ProductPurchaseDecision.PurchaseGranted
- end
- local player = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId)
- if not player then
- return Enum.ProductPurchaseDecision.NotProcessedYet
- end
- if receiptInfo.ProductId == BuyMusic then
- game.ReplicatedStorage.NewMusic:FireClient(Location(receiptInfo.PlayerId))
- end
- PurchaseHistory:SetAsync(playerProductKey, true)
- return Enum.ProductPurchaseDecision.PurchaseGranted
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement