I am making a Music Player and it is sending the string of my name as the music ID.
Local Script(one inside of play button that activates server):
script.Parent.MouseButton1Click:Connect(function() local musicID = script.Parent.Parent.Parent.musicID.Text if musicID.Text == "" then print("Don't be dumb.") else game:GetService("ReplicatedStorage").musicPlayRE:FireServer(musicID) end end)
Server:
local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local musicPlayRE = ReplicatedStorage:WaitForChild("musicPlayRE") musicPlayRE.OnServerEvent:Connect(function(musicID) musicPlayRE:FireAllClients(musicID) end)
Main Client:
local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local StarterGui = game:GetService("StarterGui") local soundService = game:GetService("SoundService") local localPlr = Players.LocalPlayer local PlayerGui = localPlr.PlayerGui local musicPlayRE = ReplicatedStorage:WaitForChild("musicPlayRE") -- announcement func -- music play func musicPlayRE.OnClientEvent:Connect(function(musicID) local sound = soundService:WaitForChild("musicSound") sound.SoundId = musicID end) -- kick func
Error:
16:39:22.246 - Players.AviaJxnny.PlayerGui.hotelClient:17: bad argument #3 to 'SoundId' (string expected, got Object)