unable to cast value to object roblox code example

Example 1: roblox unable to cast value to object

-- server script

-- You need to specify the PLAYER that you want to fire to

local player = game:GetService("Players").PLAYERNAME
local event = game.ReplicatedStorage.RemoteEvent
remoteEvent:FireClient(player, "arguments")

-- or you can fire ALL the clients 
remoteEvent:FireAllClients("arguments")

Example 2: remote function unable to cast value to object roblox

-- server script

-- You need to specify the PLAYER that you want to fire to

local player = game:GetService("Players").PLAYERNAME
local remoteFunction = game.ReplicatedStorage.RemoteFunction
remoteFunction:InvokeClient(player, "arguments")

-- or you can fire ALL the clients 
remoteEvent:InvokeAllClients("arguments")

Tags:

Lua Example