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

How to read a table after being sent via RemoteEvent?

Asked by 5 years ago

This is the Local Script (rest of the script has been excluded mate)

local x = 0

    repeat

        x = x + 1
        wait(0.033)

    until x == 31 or Input.UserInputState == Enum.UserInputState.End

    local boostValue = {}
    boostValue[1] = x

game.ReplicatedStorage.Controls.TJumpUp:FireServer(boostValue)

I've sent the table through the boundary i think this is the script:

game.ReplicatedStorage.Controls.TJumpUp.OnServerEvent:Connect(function(boostValue)

        unpack(boostValue, 1, x)

end)

but it says:

Workspace.Scripts.Controls.TJumpScript:36: bad argument #1 to 'unpack' (table expected, got Object)

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago
game.ReplicatedStorage.Controls.TJumpUp.OnServerEvent:Connect(function(player,boostValue)    
    unpack(boostValue, 1, x) 
end)

That should work, the first parameter is always gonna be the player firing the server

0
i appreciate this very much mate! stinkyest11 78 — 5y
Ad

Answer this question