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

How to use a remote event from server to client without using PlayerAdded?

Asked by 5 years ago

Hey, I have a localscript that sends info to the serverscript so the serverscript can execute code needed. I have to do this the other way around too now because the localscript now needs to execute code needed for the progression of the game. Here is what is in the wiki:

  1. local Players = game:GetService("Players")
  2. local ReplicatedStorage = game:GetService("ReplicatedStorage")

  3. local createPopupRequest = Instance.new("RemoteFunction")

  4. createPopupRequest.Name = "CreatePopupRequest"
  5. createPopupRequest.Parent = ReplicatedStorage
  6. Players.CharacterAutoLoads = false

  7. local function onPlayerAdded(player)

  8. createPopupRequest:InvokeClient(player)
  9. player:LoadCharacter()
  10. end

  11. Players.PlayerAdded:Connect(onPlayerAdded)

This is the page: https://developer.roblox.com/articles/Remote-Functions-and-Events

Above is the server side and I would like to send the info needed after the serverscript is done doing what it needs to do and not after a player is added.

Any help is greatly appreciated!!

0
I realize I could probably just change event listeners but I wouldn't know which one to use. spearmint123 20 — 5y
0
Basically what I am asking is how to use a remote function from server to client more than once spearmint123 20 — 5y
0
A RemoteEvent will pass a valid player parameter as long as it is fired via an event that passes a player or involves a player. DeceptiveCaster 3761 — 5y

Answer this question