im making a script that when you press a TextButton, it fires a RemoteEvent and changes the value of a string value to the value in the button, (the value being the name of the sound) then it will stop the previous song and start the new one but it wont play the sound, can someone help, thanks
Client Script
script.Parent.MouseButton1Click:Connect(function()
print("touched")
game.ReplicatedStorage.ChangeSong:FireServer()
print("Fired Client")
game.ReplicatedStorage["CurrentSong?"].Value = script.Parent.SongName.Value
print("changestringval")
end)
Legacy Script (V2.0)
game:GetService("ReplicatedStorage").ChangeSong.OnServerEvent:Connect(function()
StopCurrentSong:Stop()--Change StopCurrentSong to the previous songs name.
local name = game:GetService("ReplicatedStorage")["CurrentSong?"]
print("createvariable")
local song = script.Parent:FindFirstChild(tostring(name.Value))
script.Parent:FindFirstChild(tostring(name.Value)):Play()
print("play")
end)

1 comment
you should replace "script.Parent:FindFirstChild(tostring(name.Value))" at line 5 with "song". shouldn't solve the problem, but you alr made the variable so