I have this code:
Server side
Client side
But i receive the following error on the console.
How i can fix this ?
A Command with the same code works.
Server side
Code:
[COLOR=#61afef]AddEvent[/COLOR][COLOR=#abb2bf]([/COLOR][COLOR=#98c379]"OnPlayerJoin"[/COLOR][COLOR=#abb2bf], [/COLOR][COLOR=#c678dd]function[/COLOR][COLOR=#abb2bf]([/COLOR][COLOR=#abb2bf][I]player[/I][/COLOR][COLOR=#abb2bf])[/COLOR] [COLOR=#61afef]SetPlayerSpawnLocation[/COLOR][COLOR=#abb2bf](player, [/COLOR][COLOR=#d19a66]125773.000000[/COLOR][COLOR=#abb2bf], [/COLOR][COLOR=#d19a66]80246.000000[/COLOR][COLOR=#abb2bf], [/COLOR][COLOR=#d19a66]1645.000000[/COLOR][COLOR=#abb2bf], [/COLOR][COLOR=#d19a66]90.0[/COLOR][COLOR=#abb2bf])[/COLOR] [COLOR=#61afef]Delay[/COLOR][COLOR=#abb2bf]([/COLOR][COLOR=#d19a66]10000[/COLOR][COLOR=#abb2bf], [/COLOR][COLOR=#c678dd]function[/COLOR][COLOR=#abb2bf]([/COLOR][COLOR=#abb2bf][I]player[/I][/COLOR][COLOR=#abb2bf])[/COLOR] [COLOR=#c678dd]local[/COLOR][COLOR=#abb2bf] chars = {[/COLOR][COLOR=#d19a66]26[/COLOR][COLOR=#abb2bf], [/COLOR][COLOR=#d19a66]27[/COLOR][COLOR=#abb2bf], [/COLOR][COLOR=#d19a66]28[/COLOR][COLOR=#abb2bf], [/COLOR][COLOR=#d19a66]29[/COLOR][COLOR=#abb2bf]}[/COLOR] [COLOR=#c678dd]local[/COLOR][COLOR=#abb2bf] r = [/COLOR][COLOR=#56b6c2]math.random[/COLOR][COLOR=#abb2bf]([/COLOR][COLOR=#d19a66]4[/COLOR][COLOR=#abb2bf])[/COLOR] [COLOR=#61afef]CallRemoteEvent[/COLOR][COLOR=#abb2bf](player, [/COLOR][COLOR=#98c379]"SetClientClothingPreset"[/COLOR][COLOR=#abb2bf], chars[r])[/COLOR] [COLOR=#c678dd]end[/COLOR][COLOR=#abb2bf])[/COLOR] [COLOR=#c678dd]end[/COLOR][COLOR=#abb2bf])[/COLOR]
Code:
[COLOR=#61afef]AddRemoteEvent[/COLOR][COLOR=#abb2bf]([/COLOR][COLOR=#98c379]"SetClientClothingPreset"[/COLOR][COLOR=#abb2bf], [/COLOR][COLOR=#c678dd]function[/COLOR][COLOR=#abb2bf] ([/COLOR][COLOR=#abb2bf][I]presetId[/I][/COLOR][COLOR=#abb2bf])[/COLOR] [COLOR=#61afef]SetPlayerClothingPreset[/COLOR][COLOR=#abb2bf]([/COLOR][COLOR=#61afef]GetPlayerId[/COLOR][COLOR=#abb2bf](), presetId)[/COLOR] [COLOR=#c678dd]end[/COLOR][COLOR=#abb2bf])[/COLOR]
Code:
[error] [string "ttt/ttt_s.lua"]:12: bad argument #1 to 'CallRemoteEvent' (expected integer-like argument)
A Command with the same code works.
Code:
[COLOR=#c678dd]function[/COLOR][COLOR=#61afef]cmd_new[/COLOR][COLOR=#abb2bf]([/COLOR][COLOR=#abb2bf][I]player[/I][/COLOR][COLOR=#abb2bf])[/COLOR] [COLOR=#c678dd]local[/COLOR][COLOR=#abb2bf] chars = {[/COLOR][COLOR=#d19a66]26[/COLOR][COLOR=#abb2bf], [/COLOR][COLOR=#d19a66]27[/COLOR][COLOR=#abb2bf], [/COLOR][COLOR=#d19a66]28[/COLOR][COLOR=#abb2bf], [/COLOR][COLOR=#d19a66]29[/COLOR][COLOR=#abb2bf]}[/COLOR] [COLOR=#c678dd]local[/COLOR][COLOR=#abb2bf] r = [/COLOR][COLOR=#56b6c2]math.random[/COLOR][COLOR=#abb2bf]([/COLOR][COLOR=#d19a66]4[/COLOR][COLOR=#abb2bf])[/COLOR] [COLOR=#61afef]CallRemoteEvent[/COLOR][COLOR=#abb2bf](player, [/COLOR][COLOR=#98c379]"SetClientClothingPreset"[/COLOR][COLOR=#abb2bf], chars[r])[/COLOR] [COLOR=#61afef]AddPlayerChat[/COLOR][COLOR=#abb2bf](player, [/COLOR][COLOR=#98c379]"New."[/COLOR][COLOR=#abb2bf])[/COLOR] [COLOR=#c678dd]end[/COLOR] [COLOR=#61afef]AddCommand[/COLOR][COLOR=#abb2bf]([/COLOR][COLOR=#98c379]"new"[/COLOR][COLOR=#abb2bf], cmd_new)[/COLOR]
Comment