-
What do you want to achieve? Music Notification that pops from top of screen and shows - (Now Playing : SONG NAME) then slides back to top.
-
What is the issue?
Getting error -
Attempt to concatenate string with boolean error
also, gui is not moving up after wait().
- What solutions have you tried so far?
Now I had tried to go many ways around this but still can’t figure out how and why this is happening.
I looked and did my research on getting a sound info type. Using something like this -
-- pcall since GetProductInfo can return an error.
local success, product_info = pcall(function()
return game:GetService("MarketplaceService"):GetProductInfo(asset_id, Enum.InfoType.Asset)
end)
But it seems to be not working?
Here is my full code -
local Player = game.Players.LocalPlayer
local Event = game.ReplicatedStorage.MusicEvents.NewSong
local Frame = script.Parent.Parent
local sound = game.Workspace.Sound
local asset_id = tonumber(sound.SoundId)
sound.SoundId = "rbxassetid://"..tostring(asset_id)
Event.OnClientEvent:Connect(function() -- when event is fired
-- pcall since GetProductInfo can return an error.
local success, product_info = pcall(function()
return game:GetService("MarketplaceService"):GetProductInfo(asset_id, Enum.InfoType.Asset)
end)
local sound_name = success and product_info.Name
if sound.SoundId ~= nil then
Frame:TweenPosition(UDim2.new(0.288, 0, 0.026, 0),"Out","Quad",.5,true) -- changing it to in
script.Parent.Text = "Now Playing : " .. sound_name -- changing name
wait(5) -- wait to close it
Frame:TweenPosition(UDim2.new(0.288, 0,-1, 0),"In","Quad",.5,true) -- changing it to in
else
print("no song")
end
end)
I did some test, and it seemed as sound_name
is a boolean set to false which confuses me.
Should I be putting this pcall function outside of the event? I have no clue.
Also if anyone has any idea why -
Frame:TweenPosition(UDim2.new(0.288, 0, 0.026, 0),"Out","Quad",.5,true) -- changing it to in
script.Parent.Text = "Now Playing : " .. sound_name -- changing name
wait(5) -- wait to close it
Frame:TweenPosition(UDim2.new(0.288, 0,-1, 0),"In","Quad",.5,true) -- changing it to in
this is not moving the frame back up after it comes down let me know.
Thankyou so much for reading this, I am in need of assistance on what is going on.