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

Why can I not pass my data with a remote event using :FireServer()?

Asked by 3 years ago
if plr.Finished.Value == true then
                wait(1)
                passedChecks.SendLapTime:FireServer(tonumber(numberText), plr)
                plr.PlayerGui.RaceGui.RaceStopwatch.Visible = false
                break
            end
passedChecks.SendLapTime.OnServerEvent:Connect(function(lapTime, plr)
    print(lapTime)
    plr.RacingStats.LapTime.Value = lapTime

end)

I keep getting an error that says attempt to index number with 'RacingStats'. I don't understand. Please help me.

1 answer

Log in to vote
1
Answered by 3 years ago

Player is the first argument for OnServerEvent, not the second.

Because you used it as the second, "plr" is being defined as the lap time and "lapTime" is being defined as the player. You should switch the two because .RacingStats does not exist in a number.

Ad

Answer this question