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

Parameters not working as intended?

Asked by 3 years ago
Edited 3 years ago

This has been flipping me for hours.

On Replicated Storage: LoadingScreenMarkAsReadyEvent [RemoteEvent]

On Local Script:

local LoadingScreenMarkAsReadyEvent = game.ReplicatedStorage:WaitForChild('LoadingScreenMarkAsReadyEvent)

local Team1 = {}
local Team2 = {}
local teamName = "Red"
local player = game.Players.LocalPlayer

print(player.Name) --/Comment1
    print(teamName) --/Comment2
    print(teamName .. " ") --/Comment3

LoadingScreenMarkAsReadyEvent:FireServer(player, teamName, Team1, Team2)

Comment1: Consteleo

Comment2: Red

Comment3: Red

On Server Script:

local LoadingScreenMarkAsReadyEvent = game.ReplicatedStorage:WaitForChild('LoadingScreenMarkAsReadyEvent)

local function LoadingScreenMarkAsReady(localPlayer, teamName, Team1, Team2)
    print(localPlayer.Name) --/Comment1
    print(teamName) --/Comment2
    print(teamName .. " ") --/Comment3
end

LoadingScreenMarkAsReadyEvent:OnServerEvent:Connect(LoadingScreenMarkAsReady)

Comment1: Consteleo

Comment2: Consteleo //???

Comment3: Error: Attempt to concatenate Instance with string. //?????????????

There is no line jump in my actual code. It's just in the preview of ScriptingHelpers Lua code block

1
The OnServerEvent signal automatically receives the Client firing the Remote. The first argument is a l w a y s the Player Object of said Client. You haven't accommodated for this, which has pushed each parameter over one. Ziffixture 6913 — 3y
1
The quickest fix is to remove the redundancy in your LocalScript. Don't pass the Player when calling :FireServer(). Ziffixture 6913 — 3y
0
Oh my god, thank you very much. You have saved my sanity. Bless your day! ConsteIeo 63 — 3y

Answer this question