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

Unable to cast value to Object?

Asked by 6 years ago

What happening?

script.Parent.MouseClick:connect(function()
    game:GetService("ReplicatedStorage"):FindFirstChild("OnEat"):FireClient("eat")
end)


0
script/local script? GingeyLol 338 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

The function “:FireClient(playerToSendTo, additionalArguments)” starts with the player, not the arguments.

RemoteEvent:FireClient(Player,”eat”)

It gives “unable to cast value to object” because its expecting the “Player” object but gets the string “eat” in its place.

0
Now it does nothing IcyBlazeRB 28 — 6y
0
How are you getting the player?l NexanianStudios 91 — 6y
Ad

Answer this question