generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: --Unable to cast value to object-- error Q

Previous Thread :: Next Thread 
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
05 Jun 2017 02:42 PM
--serverside

Rep.Events.Add:FireClient("update char", Amount)

--clientside

Rep.Events.Add.OnClientEvent:connect(function(Player,Type,Amount)
print("This works")

the print does not fire. Please help.
Report Abuse
SinisterMemories is not online. SinisterMemories
Joined: 21 Mar 2013
Total Posts: 4892
05 Jun 2017 02:44 PM
your unable to cast a value to an object.


#code print("oh no an errorz!")
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
05 Jun 2017 02:45 PM
i can see that, but can some please explain with reference to my code, what it is im doing wrong, thanks.
Report Abuse
Julian_Orteil is not online. Julian_Orteil
Joined: 14 Aug 2012
Total Posts: 968
05 Jun 2017 02:45 PM
"update char" is where it is wrong.

When you fire a single client with RemoteEvents, you have to specify the player. The player HAS to be an object, not a string (so not "Player1"; but, game.Players.Player1)


Sometimes, it's the people no one imagines anything of, who do the things that no one can imagine.
Report Abuse
PurelyMystic is not online. PurelyMystic
Joined: 24 May 2010
Total Posts: 931
05 Jun 2017 02:46 PM
--serverside

Rep.Events.Add:FireClient("update char", Amount)

--clientside

Rep.Events.Add.OnClientEvent:connect(function(Player,Type,Amount)
print("This works")

You are expecting 3 arguments. The Player argument is only valid from client to server. So this should work. Or not I am not a pro ok. Lol.
--serverside

Rep.Events.Add:FireClient("update char", Amount)

--clientside

Rep.Events.Add.OnClientEvent:connect(function(Type,Amount)
print("This works")
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
05 Jun 2017 02:47 PM
by specifiy the player like, game.Players:FindFirstChild(Player) [Given that i have their name only]?

Report Abuse
Julian_Orteil is not online. Julian_Orteil
Joined: 14 Aug 2012
Total Posts: 968
05 Jun 2017 02:50 PM
Yes.


Order of parameters for RE:

RemoteEvent:FireClient(object Player, args)
RemoteEvent:FireAllClients(args) -- This will fire to every single player in the game, so a player specified is not needed


Sometimes, it's the people no one imagines anything of, who do the things that no one can imagine.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image