D3vel0per
|
  |
| Joined: 16 Feb 2010 |
| Total Posts: 5078 |
|
|
| 09 Jul 2014 10:29 AM |
player1 = game.Workspace.Player1.Value player2 = game.Workspace.Player2.Value player3 = game.Workspace.Player3.Value player4 = game.Workspace.Player4.Value repeat if script.Parent.RequestStartG.Value == true then local p1 = game.Players:GetPlayerFromCharacter(player1) local p2 = game.Players:GetPlayerFromCharacter(player2) local p3 = game.Players:GetPlayerFromCharacter(player3) local p4 = game.Players:GetPlayerFromCharacter(player4) print(p1.Character.Name) end until false
can someone help me with this, I am trying to test this out by printing the player1 value (the players name), but it is not printing anything
~I don't play games, I make them~ |
|
|
| Report Abuse |
|
|
WishNite
|
  |
| Joined: 11 Feb 2009 |
| Total Posts: 15828 |
|
|
| 09 Jul 2014 10:30 AM |
if script.Parent.RequestStartG.Value == true then
is not true probably |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 09 Jul 2014 10:30 AM |
| Delete .Value from all those players |
|
|
| Report Abuse |
|
|
D3vel0per
|
  |
| Joined: 16 Feb 2010 |
| Total Posts: 5078 |
|
|
| 09 Jul 2014 10:54 AM |
@Wish it is true
~I don't play games, I make them~ |
|
|
| Report Abuse |
|
|
D3vel0per
|
  |
| Joined: 16 Feb 2010 |
| Total Posts: 5078 |
|
|
| 09 Jul 2014 10:56 AM |
@Max why? The value is the character's name, I need that to put into the GetPlayerFromCharacter so I can get the player
~I don't play games, I make them~ |
|
|
| Report Abuse |
|
|
D3vel0per
|
  |
| Joined: 16 Feb 2010 |
| Total Posts: 5078 |
|
|
| 09 Jul 2014 11:08 AM |
bump
~I don't play games, I make them~ |
|
|
| Report Abuse |
|
|
D3vel0per
|
  |
| Joined: 16 Feb 2010 |
| Total Posts: 5078 |
|
|
| 09 Jul 2014 11:24 AM |
Now it says unable to cast value on object
~I don't play games, I make them~ |
|
|
| Report Abuse |
|
|
UgOsMiLy
|
  |
| Joined: 15 Sep 2009 |
| Total Posts: 2095 |
|
|
| 09 Jul 2014 11:28 AM |
Max is right. You have to delete .Value from all of the definitions.
Like this:
player1 = game.Workspace.Player1 player2 = game.Workspace.Player2 player3 = game.Workspace.Player3 player4 = game.Workspace.Player4 repeat if script.Parent.RequestStartG.Value == true then local p1 = game.Players:GetPlayerFromCharacter(player1.Value) local p2 = game.Players:GetPlayerFromCharacter(player2.Value) local p3 = game.Players:GetPlayerFromCharacter(player3.Value) local p4 = game.Players:GetPlayerFromCharacter(player4.Value)
I don't know why, but it's just that way. |
|
|
| Report Abuse |
|
|
D3vel0per
|
  |
| Joined: 16 Feb 2010 |
| Total Posts: 5078 |
|
|
| 09 Jul 2014 11:47 AM |
It still isn't working, it still says unable to cast value on object
~I don't play games, I make them~ |
|
|
| Report Abuse |
|
|
|
| 09 Jul 2014 11:49 AM |
:GetPlayerFromCharacter(game.Workspace:FindFirstChild(player.Value);
|
|
|
| Report Abuse |
|
|
|
| 09 Jul 2014 11:51 AM |
| is player1 an object value? |
|
|
| Report Abuse |
|
|
D3vel0per
|
  |
| Joined: 16 Feb 2010 |
| Total Posts: 5078 |
|
|
| 09 Jul 2014 12:20 PM |
No, it is a string value
~I don't play games, I make them~ |
|
|
| Report Abuse |
|
|
D3vel0per
|
  |
| Joined: 16 Feb 2010 |
| Total Posts: 5078 |
|
|
| 09 Jul 2014 12:23 PM |
It is a string value because it holds the players name
~I don't play games, I make them~ |
|
|
| Report Abuse |
|
|
|
| 09 Jul 2014 12:25 PM |
game.Players:findFirstChild(player1)
|
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 09 Jul 2014 12:26 PM |
Then you should be doing
game:GetService"Players":FindFirstChild(Workspace.Player1.Value)
:GetPlayerFromCharacter() only works with objs, not strings and only returns true if the obj is actually a player's character model. |
|
|
| Report Abuse |
|
|
|
| 09 Jul 2014 12:28 PM |
GetPlayerFromCharacter() is used for the character. Try doing:
player1 = game.Workspace.Player1.Value player2 = game.Workspace.Player2.Value player3 = game.Workspace.Player3.Value player4 = game.Workspace.Player4.Value repeat if script.Parent.RequestStartG.Value == true then local p1 = game.Players:GetPlayerFromCharacter(Workspace:FindFirstChild(player1.Value)) local p2 = game.Players:GetPlayerFromCharacter(Workspace:FindFirstChild(player2.Value)) local p3 = game.Players:GetPlayerFromCharacter(Workspace:FindFirstChild(player3.Value)) local p4 = game.Players:GetPlayerFromCharacter(Workspace:FindFirstChild(player4.Value)) print(p1.Character.Name) end until false
|
|
|
| Report Abuse |
|
|
D3vel0per
|
  |
| Joined: 16 Feb 2010 |
| Total Posts: 5078 |
|
|
| 09 Jul 2014 12:43 PM |
@ROBLOX It says in the output: argument 1 missing or nil
~I don't play games, I make them~ |
|
|
| Report Abuse |
|
|
D3vel0per
|
  |
| Joined: 16 Feb 2010 |
| Total Posts: 5078 |
|
|
| 09 Jul 2014 12:44 PM |
Oh never mind, I forgot to change the value changing script, let me fix that.
~I don't play games, I make them~ |
|
|
| Report Abuse |
|
|
D3vel0per
|
  |
| Joined: 16 Feb 2010 |
| Total Posts: 5078 |
|
|
| 09 Jul 2014 12:50 PM |
Nope, doesn't work :/
~I don't play games, I make them~ |
|
|
| Report Abuse |
|
|
D3vel0per
|
  |
| Joined: 16 Feb 2010 |
| Total Posts: 5078 |
|
|
| 09 Jul 2014 01:04 PM |
help please
~I don't play games, I make them~ |
|
|
| Report Abuse |
|
|
D3vel0per
|
  |
| Joined: 16 Feb 2010 |
| Total Posts: 5078 |
|
|
| 09 Jul 2014 01:34 PM |
bump
~I don't play games, I make them~ |
|
|
| Report Abuse |
|
|
D3vel0per
|
  |
| Joined: 16 Feb 2010 |
| Total Posts: 5078 |
|
|
| 09 Jul 2014 01:48 PM |
ugh come on .-.
~I don't play games, I make them~ |
|
|
| Report Abuse |
|
|
D3vel0per
|
  |
| Joined: 16 Feb 2010 |
| Total Posts: 5078 |
|
|
| 09 Jul 2014 03:23 PM |
Come on guys help >:/
#ANTIMERELY |
|
|
| Report Abuse |
|
|
|
| 09 Jul 2014 03:34 PM |
Hello,
Welcome to Scripting Helpers, We see your request for help, however, it seems as if you have already been helped. The others are trying to point out that you cannot use the method "GetPlayerFromCharacter" on a string value, it will only work on the character. An alternative route is to use "FindFirstChild" method. This method accepts strings as an argument and will find the object that has the name specified. So in this instance we want to player.
player1 = game.Workspace.Player1
if game.Players:findFirstChild(player1.Value) then --PLAYER EXISTS end
We can explain this even further. Unfortunately, I do not see any attempt of fixing this yourself. Go and try to see if you are able to apply this, if not, simply ask a specific question and not "FIX PLEASE."
Thank you for choosing Scripting Helpers for your issue. Come back again! :) |
|
|
| Report Abuse |
|
|
tempodoa
|
  |
| Joined: 06 Aug 2012 |
| Total Posts: 251 |
|
| |
|