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
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Unable to cast value to Object

Previous Thread :: Next Thread 
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 11:16 AM
I'm always getting this..

Players is the table of players, and it works fine.

--Server
for k, v in next, game.Players:GetChildren() do
if v == Players[1] then
game.ReplicatedStorage.RemoteEvents.MakeMenuVisible:FireClient(Players[1]);
end;
end;

--Local
game.ReplicatedStorage.RemoteEvents.MakeMenuVisible.OnClientEvent:connect(function()
script.Parent.Menu.Frame.Visible = true;
end);
Report Abuse
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 11:28 AM
Bump. Sorry if it's a nubish help request. I have the attention span of a pine cone.
Report Abuse
EchoReaper is online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
06 Sep 2015 11:34 AM
Put this in your code somewhere:

function printTable(t, tabs)
local tabs = tabs and tabs + 1 or 0
for i,v in next,t do
if type(v) == "table" then
if type(i) == "string" then
print(string.rep(" ", tabs).."[\""..i.."\"] = {")
else
print(string.rep(" ", tabs)..tostring(i).." = {")
end
printTable(v, tabs)
print(string.rep(" ", tabs).."}",(tabs > 0 and ";" or ""))
else
if type(i) == "string" then
print(string.rep(" ", tabs).."[\""..i.."\"] =",v,";")
else
print(string.rep(" ", tabs)..tostring(i).." =",v,";")
end
end
end
end

and then do
printTable(players)

and post the results here.
Report Abuse
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 11:38 AM
No output.
Report Abuse
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 11:38 AM
Actually,

11:28:01.774 - httpGet http://www.roblox.com/asset/?id=291546820 failed. Trying again. Error: HTTP 503 (HTTP/1.1 503 Service Unavailable). Elapsed time: 0.724076
11:28:01.819 - httpGet http://www.roblox.com/asset/?versionid=33382785&serverplaceid=293949099 failed. Trying again. Error: HTTP 503 (HTTP/1.1 503 Service Unavailable). Elapsed time: 0.76344
11:28:01.821 - httpGet http://www.roblox.com/asset/?id=217761022 failed. Trying again. Error: HTTP 503 (HTTP/1.1 503 Service Unavailable). Elapsed time: 0.742466
11:28:01.822 - httpGet http://www.roblox.com/asset/?id=291546973 failed. Trying again. Error: HTTP 503 (HTTP/1.1 503 Service Unavailable). Elapsed time: 0.758466
11:28:01.823 - httpGet http://www.roblox.com/Asset/BodyColors.ashx?avatarHash=38e917dadb6613b6a5d04dba26b80adc&serverplaceid=293949099 failed. Trying again. Error: HTTP 503 (HTTP/1.1 503 Service Unavailable). Elapsed time: 0.774466
11:28:01.824 - httpGet http://www.roblox.com/asset/?id=291547148 failed. Trying again. Error: HTTP 503 (HTTP/1.1 503 Service Unavailable). Elapsed time: 0.763476
11:28:01.826 - httpGet http://www.roblox.com/asset/?id=180435792&serverplaceid=293949099&clientinsert=0 failed. Trying again. Error: HTTP 503 (HTTP/1.1 503 Service Unavailable). Elapsed time: 0.778472
11:28:01.827 - httpGet http://www.roblox.com/asset/?id=39226062&serverplaceid=293949099&clientinsert=0 failed. Trying again. Error: HTTP 503 (HTTP/1.1 503 Service Unavailable). Elapsed time: 0.831599
11:28:01.828 - httpGet http://www.roblox.com/asset/?id=291547264 failed. Trying again. Error: HTTP 503 (HTTP/1.1 503 Service Unavailable). Elapsed time: 0.766482
11:28:01.829 - httpGet http://www.roblox.com/asset/?versionid=261209865&serverplaceid=293949099 failed. Trying again. Error: HTTP 503 (HTTP/1.1 503 Service Unavailable). Elapsed time: 0.767482
11:28:01.831 - httpGet http://www.roblox.com/asset/?versionid=62708396&serverplaceid=293949099 failed. Trying again. Error: HTTP 503 (HTTP/1.1 503 Service Unavailable). Elapsed time: 0.770489
11:28:01.832 - httpGet http://www.roblox.com/asset/?versionid=327664111&serverplaceid=293949099 failed. Trying again. Error: HTTP 503 (HTTP/1.1 503 Service Unavailable). Elapsed time: 0.782489
11:28:02.582 - httpGet http://www.roblox.com/asset/?id=180435571&serverplaceid=293949099&clientinsert=0 failed. Trying again. Error: HTTP 503 (HTTP/1.1 503 Service Unavailable). Elapsed time: 1.79722
11:28:02.593 - httpGet http://www.roblox.com/asset/?id=180436148&serverplaceid=293949099&clientinsert=0 failed. Trying again. Error: HTTP 503 (HTTP/1.1 503 Service Unavailable). Elapsed time: 1.74809
11:28:02.594 - httpGet http://www.roblox.com/asset/?id=293948264 failed. Trying again. Error: HTTP 503 (HTTP/1.1 503 Service Unavailable). Elapsed time: 1.80621
11:28:02.596 - httpGet http://www.roblox.com/asset/?id=293948265 failed. Trying again. Error: HTTP 503 (HTTP/1.1 503 Service Unavailable). Elapsed time: 1.8162
Report Abuse
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 11:39 AM
But nothing to do with the script lol.
Report Abuse
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 11:40 AM
I think? .-.
Report Abuse
OzzyFin is not online. OzzyFin
Joined: 07 Jun 2011
Total Posts: 3600
06 Sep 2015 11:40 AM
try

print(Players[1]:GetFullName())

if it gives you game.Players.PlayerObject there shouldnt be anything wrong

anyways you should be using :GetPlayers() whenever getting players from players service
Report Abuse
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 11:44 AM
No output s: Here's the table. If it loads before the player does, it has to be atleast Computer_1, so I don't see why it's not working

local Players = {"Computer_1", "Computer_2", "Computer_3", "Computer_4"};
local updateName = game.ReplicatedStorage.RemoteFunctions.nameUpdate;

function UpdateClients()
for i, player in pairs(game.Players:GetPlayers()) do
updateName:InvokeClient(player, Players);
end;
end;
function leaving(PlayerLeave)
for k, v in pairs(Players)do
if v == PlayerLeave.Name then
if PlayerLeave.Name == Players[1] then
Players[1] = "Computer_1";
elseif PlayerLeave.Name == Players[2] then
Players[2] = "Computer_2";
elseif PlayerLeave.Name == Players[3] then
Players[3] = "Computer_3";
elseif PlayerLeave.Name == Players[4] then
Players[4] = "Computer_4";
end;
end;
end;
end;
function joining(PlayerJoin)
if Players[1] == "Computer_1" then
Players[1] = PlayerJoin.Name;
elseif Players[2] == "Computer_2" then
Players[2] = PlayerJoin.Name;
elseif Players[3] == "Computer_3" then
Players[3] = PlayerJoin.Name;
elseif Players[4] == "Computer_4" then
Players[4] = PlayerJoin.Name;
end;
end;

game.Players.PlayerAdded:connect(function(PlayerJoin)
joining(PlayerJoin);
UpdateClients();
end);
game.Players.PlayerRemoving:connect(function(PlayerLeave)
leaving(PlayerLeave);
UpdateClients();
end);

UpdateClients();
Report Abuse
OzzyFin is not online. OzzyFin
Joined: 07 Jun 2011
Total Posts: 3600
06 Sep 2015 11:46 AM
FireClient() requires a player object as its first argument
you are giving it a string, "Computer_1"
Report Abuse
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 11:47 AM
Is there any way around it? I kind of need it how it is >.<
Report Abuse
OzzyFin is not online. OzzyFin
Joined: 07 Jun 2011
Total Posts: 3600
06 Sep 2015 11:47 AM
didnt see this line
Players[1] = PlayerJoin.Name;

but it doesnt really change anything
PlayerJoin.Name is still a string, not object
Report Abuse
OzzyFin is not online. OzzyFin
Joined: 07 Jun 2011
Total Posts: 3600
06 Sep 2015 11:47 AM
you can just FireClient(v) duh
Report Abuse
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 11:49 AM
for k, v in next, Players do
if v == Players[4] then
if Players[4] == "Computer_4" then
rollDice();
Yellow:movePiece();
Land(Yellow, Yellow:returnLocation());
resetDice();
manageTurns:nextTurn();
else
for k, v in next, game.Players:GetChildren() do
if v == Players[4] then
game.ReplicatedStorage.RemoteEvents.MakeMenuVisible:FireClient(v);
end;
end;
end;
manageTurns:nextTurn();
Yellow:movePiece();
Land(Yellow, Yellow:returnLocation());
end;
end;


I dont see how im passing in the string, it should only be the character object when it fires.
Report Abuse
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 11:49 AM
I'll try it.
Report Abuse
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 11:51 AM
Nope.
Report Abuse
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 11:51 AM
Forgot I tried that already xDD
Report Abuse
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 11:53 AM
I can't figure out why print(Players[1]); can't even work.
Report Abuse
OzzyFin is not online. OzzyFin
Joined: 07 Jun 2011
Total Posts: 3600
06 Sep 2015 11:56 AM
print(table.concat(Players," "))

is ur script disabled or what
Report Abuse
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 11:57 AM
No output, and nope. Rest of the script runs fine.
Report Abuse
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 12:00 PM
Could something be wrong with my Studio? I have this problem all the time with Remote Events.
Report Abuse
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 12:07 PM
Nope, not Studio. I reinstalled.
Report Abuse
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 12:12 PM
Answers, I need answers! ._.
Report Abuse
D3M3N73D is not online. D3M3N73D
Joined: 20 Jul 2010
Total Posts: 232
06 Sep 2015 12:25 PM
Bump. It works on a fresh slate. I don't know how it's referring to an Object, none of my OOP has anything to do with the term "Players".
Report Abuse
NightRider1070 is not online. NightRider1070
Joined: 14 Sep 2015
Total Posts: 3
23 Sep 2015 10:19 AM
Im getting the same error
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 2Go to page: [1], 2 Next
 
 
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