Hello, DevForum users. I do know there is a similar topic as this, but this is a different gui as his, this is the reason why I’m seeking help from here.
My current issue is, my music gui which is suppose to show what music is playing in the game, and the title of this music. But the issue is, when I publish the game to Roblox, tested in the main game. It doesn’t show the title, when it works in Studio.
I tried looking for solutions in Youtube and DevForum, still didn’t get what they are saying or couldn’t find what I wanted to fix.
Here’s some image, hope some of you guys could find the solution to this annoying matter of mine.
-
This image is tested in studio.
-
This image is tested in the main published game.
This is the script in the replicatedfirst.
local plr = game.Players.LocalPlayer
local ui = plr:WaitForChild("PlayerGui"):WaitForChild("Music Bar", 99):WaitForChild("MUSICBAR",99)
local sound = game.Workspace:WaitForChild("SongAudio")
local Events = {}
for i,v in pairs(game.ReplicatedStorage.Events:GetChildren()) do Events[v.Name] = v end
local event = Events["PlayingRemote"]
local runService = game:GetService("RunService")
local ts = tostring
local mf = math.floor
if event then
print 'loaded'
else
return
end
local function getTime(mode, t)
if mode == "max" then
local sec = 0
local min = 0
local length = mf(t)
for i = 1, length do
sec = sec + 1
if sec >= 60 then
min = min + 1
sec = 0
else
sec = length - 60 * min
end
runService.RenderStepped:wait()
end
if ts(sec):len() < 2 then
sec = "0" .. ts(sec)
end
wait()
return min .. ":" .. sec
elseif mode == "cur" then
do
local sec = 0
local min = 0
local position = mf(t)
sec = position
function checksec()
wait()
if sec >= 60 then
min = min + 1
sec = sec - 60
checksec()
end
end
checksec()
sec = ts(sec)
if ts(sec):len() < 2 then
sec = "0" .. ts(sec)
end
return min .. ":" .. sec
end
end
end
event.OnClientEvent:Connect(function(songName, songArtist, boolRequested, requestedUser)
repeat wait()
until sound.isLoaded == true
wait()
ui.song.Text = songName
ui.artist.Text = songArtist
end)