i have tried to make a music player gui but it seems the variable is messed up and is nto detectign the id from textbox? i am quite new to lua a year of doing it heres my code
local id = script.Parent.Parent.ID.Text
local left = game.Workspace.left
local right = game.Workspace.right
script.Parent.MouseButton1Click:Connect(function()
right.Sound:Stop()
left.Sound:Stop()
right.Sound.SoundId = ('rbxassetid://' .. id)
left.Sound.SoundId = ('rbxassetid://' .. id)
end)
Why did you use ('rbxassetid://' .. id)
, that should not be in brackets.
local id = script.Parent.Parent.ID.Text local left = game.Workspace.left local right = game.Workspace.right script.Parent.MouseButton1Click:Connect(function() right.Sound:Stop() left.Sound:Stop() right.Sound.SoundId = "rbxassetid://" .. id left.Sound.SoundId = "rbxassetid://'".. id end)
And also this needs to be in a local script for the MouseButton1Click to work properly, you cant register clicks in a server scripts.