I’m currently experiencing an issue where the intro to my game isn’t playing but I’m not getting any errors related to it in the output. I was watching a tutorial from Gamer M8 and followed through with them to make but of course I need to add a few extra things for my situation. He was mainly working with just a TextLabel and ImageLabel while I’m working with
5 different ImageLabels.
How things are set up:
Replicated Storage:
RemoteEvent named “IntroEvent”
As you see, there’s no errors in the output relating to any of this but still doesn’t play?
What have I tried?
Rewatched his video several times and took a good look at my code. Everything looked fine and almost the same as his yet it didn’t play for me. Even though I don’t specialize in scripting and have an ok understanding on how half of the things work, I’m sure there’s some small changes that I’d have to make but I wouldn’t know what right away. I’d appreciate any help as I’m sure I’m close to figuring this out but need a hand from someone experienced to assist me with this little issue!
This is happening because the client has connected to the remote before it was fired. I would do a RemoteFunction, then keep invoking it until the client responds (return true)
Server
repeat wait()
local responded = RemoteFunction:InvokeClient(Player)
until responded == true
Client
Remote.OnClientInvoke = function()
spawn(function()
-- code here
end)
return true
end
What is the purpose of you using a repeat until loop? You’re polling which is bad but that doesn’t matter since RemoteFunctions yields the program until it gets a response, also you shouldn’t use remoteFunctions from the server due to these reasons, as per the RemoteFunction page:
If the client throws an error, the server will throw the error too.
If the client disconnects while it’s being invoked, the InvokeClient() call will error.
If the client never returns a value, the server will hang forever.
Secondly, spawn will be depreciated soon and it’s better to either use task.spawn or coroutines.
Finally, RemoteFunctions should only be used when you need a return value. You do not need the return value for this.