Weird thing with Workspace

I really don’t know how to start this

So, I was making a loading screen gui for my game, and I put it all on ReplicatedFirst
Now, this part of the script:

local tweenserice = game:GetService("TweenService")
local Assets = game:GetDescendants()
local music = workspace.music --this one

Is causing this???
Screenshot (17)

I really do NOT know what I did wrong, and if I made some stupid mistake, please call me out on it. I’m stuck on this problem for a while now and it’s driving me INSANE.

As the contents of ReplicatedFirst replicate to the client before anything else in the game

This means the music in workspace hasn’t loaded yet because it isn’t inside replicated first. Try putting the music inside replicated first

  • Any objects that are to be used by a LocalScript in ReplicatedFirst should also be parented to ReplicatedFirst. Otherwise, they may replicate to the client late, yielding the script and negating the benefit of ReplicatedFirst.
5 Likes

I’ll go and test it out later, I’ll reply as soon as I can, ty!

local music = game:GetService("SoundService"):WaitForChild("music")
music:Play()
local tweenserice = game:GetService("TweenService")
local Assets = game:GetDescendants()
local music = workspace:WaitForChild("music")

Maybe this will work for you?

tried that, didn’t work surprisingly

local tweenserice = game:GetService("TweenService")
local Assets = game:GetDescendants()
repeat task.wait() until workspace:FindFirstChild("music")
local music = workspace:FindFirstChild("music")

Try number 2?

I’m not on Roblox Studio rn, so I’ll see if it works later

Sounds good. As a heads up, It will have a little wait time. It waits until it can find the music. Shouldn’t be more then a second or 2, but just be aware of that if it does work.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.