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

[Solved] Problems with Remote Function Call order?

Asked by 2 years ago
Edited 2 years ago

Client:

Mode is Normal

Difficulty is Easy

local RS = game:WaitForChild("ReplicatedStorage") 
local EV = game.ReplicatedStorage:WaitForChild("ServerEventHandeler")
local SC = game.ReplicatedStorage.ServerEventHandeler:WaitForChild("ServerCreation")
local LP = game.Players.LocalPlayer
local Dif = game.ReplicatedStorage.Settings.Difficulty.Value
local Modee = game.ReplicatedStorage.Settings.Mode.Value

script.Parent.MouseButton1Click:Connect(function()
    print("SC Waiting")
    SC:FireServer(LP ,Dif ,Modee)
    print("SC Fired")
end)

Server

local function lobby(LP ,Dif ,Modee)
    print("LP is", LP.Name)
    print("Dif", Dif)
    print("Mode", Modee)        
end

local SC = game.ReplicatedStorage.ServerEventHandeler:WaitForChild("ServerCreation")
SC.OnServerEvent:Connect(lobby)

The output is

LP is tommymcoco1

Dif tommymcoco1

Mode Easy

0
Difficulty and Mode are both String values tommymcoco1 39 — 2y

1 answer

Log in to vote
0
Answered by
imKirda 4491 Moderation Voter Community Moderator
2 years ago

Remote functions automatically pass the player who invoked the function as first parameter.

local function lobby(LP,Dif ,Modee)
    print("\"LP\" is", LP)
    print("Dif", Dif)
    print("Mode", Modee)        
end

And for the client you just don't pass it:

SC:FireServer(Dif ,Modee)

In your case the LP parameter was player passed by the remote function, Dif was player passed by you and Mode was Dif parameter passed by you on client, the fourth parameter was the actual Modee but it got ignored.

0
Thank you tommymcoco1 39 — 2y
Ad

Answer this question