Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Remote Events - Why do I get Infinite yield possible from this line?

On this page (http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial) tried page, I tried using this sample:

game.Players.LocalPlayer:WaitForChild("MyClientEvent").OnClientEvent:connect(function()
	print("EventHappened")
end)

However, I get this error:

Infinite yield possible on 'Players.Player1:WaitForChild("MyClientEvent")'

Why is this? If I have a ChildAdded event it is triggered, but this doesnt work.

Also, separate question. I'm using remote events for the server to send data to specific clients. But, when I instantiate the event inside of a player, the event shows up on that player but in all clients. Could someone theoretically cheat to see that the even says?

1 answer

You must have an event in every player called "MyClientEvent", which is what it waits for. I strongly recommend not having an event for every player though. Remote events have a FireClient function anyway.

And yeah, exploiters can see all of the arguments of the events, and even FireServer at will. You can probably ignore it. If you are super worried, you can do simple checks on the server to see if the client info fits your game context.

3 comments

0

The reason I have the event sent to one client is because the parameter of it will be the players inventory. The inventory is managed on the server to avoid exploitation, but I also dont want other players to see what one person has, thus it needs to be private. Thank you for the response. I will look into FireClient now.

0

Ima bit rusty. So, I would Instance.new() a RemoteEvent. I assume it could then go anywhere. Then, I set the data. Set the name, parameter of it. Then I cann :FireClient() on it. In FireClient I pass the player and additional parameters I set. What do I do to get the client to detect the remote event? What do I have to put in a local script to obtain the data?

0

Ok, I inderstand. I got it working. I simply didnt call fire. I'm not the brightest. Thanks for your support, though. Apprec :). I would upvote, but I'm too low :( sorry

This discussion is preserved as it was. New answers, comments, and votes are closed.