local RE =game.ReplicatedStorage:WaitForChild("RemoteEvent") RE.OnServerEvent:Connect(function(sender, ID,Gen) if Gen == "Play" then local Plr=game.Workspace:FindFirstChild(sender.Name) if not Plr:FindFirstChild("Sound") then local Sound = Instance.new("Sound",Plr) Sound.SoundId = ID Sound.Looped = true Sound:Play() end if Gen == "Pause" then Plr:FindFirstChild("Sound") end if Gen == "Stop" then Plr:FindFirstChild("Sound"):Destroy() end end end)
Just made this radio script, but it doesn't work. I made a variable called gen, that variable checks if the pause button is clicked and fired but it doesn't work please help. Like i instead of having 3 remote events just have one with just setting some variables for it??
--local script local RE = game.ReplicatedStorage:WaitForChild("RemoteEvent") script.Parent.Play.MouseButton1Click:Connect(function() if script.Parent.TextBox.TextBox.Text == "" == false then local Plr = game.Players.LocalPlayer local Asset = game.MarketplaceService:GetProductInfo(script.Parent.TextBox.TextBox.Text) script.Parent.SongName.Text = Asset.Name script.Parent.UploadedBy.Text = "Uploaded by "..Asset.Creator.Name RE:FireServer("rbxassetid://"..script.Parent.TextBox.TextBox.Text,"Play") end end) script.Parent.Pause.MouseButton1Click:Connect(function() RE:FireServer("rbxassetid://"..script.Parent.TextBox.TextBox.Text,"Pause") end) script.parent.Stop.MouseButton1Click:Connect(function() RE:FireServer("rbxassetid://"..script.Parent.TextBox.TextBox.Text,"Stop") script.Parent.SongName.Text = "" script.parent.UploadedBy.Text = "Uploaded by nobody" script.Parent.TextBox.TextBox.Text = "" end)
--ServerScript local RE =game.ReplicatedStorage:WaitForChild("RemoteEvent") RE.OnServerEvent:Connect(function(sender, ID,Gen) if Gen == "Play" then local Plr=game.Workspace:FindFirstChild(sender.Name) if not Plr:FindFirstChild("Sound") then local Sound = Instance.new("Sound",Plr) Sound.SoundId = ID Sound.Looped = true Sound:Play() end if Gen == "Pause" then Plr:FindFirstChild("Sound") end if Gen == "Stop" then Plr:FindFirstChild("Sound"):Destroy() end end end)