Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
wetrel 15
7 years ago

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

Log in to vote
0
Answered by
cabbler 1942 Moderation Voter
7 years ago

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.

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. wetrel 15 — 7y
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? wetrel 15 — 7y
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 wetrel 15 — 7y
Ad

Answer this question