KOzero
|
  |
| Joined: 11 May 2010 |
| Total Posts: 1411 |
|
|
| 13 Jul 2014 02:48 AM |
I have seen the wiki and related threads to this topic but this one is different. I need to call the pathway to the character but I don't know how I can!? Be in mind this is in a server script, so LocalPlayer won't work.
local Player = game:GetService("Players"):GetPlayerFromCharacter()--What Should go between the parenthesis ??
Player.CharacterAdded:connect(function(character) Player.Character.Humanoid.Seated:connect(function() end) end) |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 02:52 AM |
An example would be something like, game.Workspace.Part.Touched:connect(function(Toucher) if Toucher.Parent:FindFirstChild("Humanoid") then Player = game.Players:GetPlayerFromCharacter(Toucher.Parent.Name) print(Player.Name) end end) --The .Name may not be necessary in the parameters in :GetPlayerFromCharacter(). |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 03:01 AM |
| .Name shouldn't be there, just "Toucher.Parent" as that is the character. |
|
|
| Report Abuse |
|
|
KOzero
|
  |
| Joined: 11 May 2010 |
| Total Posts: 1411 |
|
|
| 13 Jul 2014 03:05 AM |
... Do you see a touch event in my code,Nope I don't see one.
Anony I know how it works but in my script above I don't think there is a way to get the pathway of the character. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 03:06 AM |
| Do you mean how to get the character from the player? You didn't state the problem very clearly, if so: Game.Players.Player.Character.Head:Destroy() |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 13 Jul 2014 03:15 AM |
| Anony the GetPlaerFromChar argument is an object value |
|
|
| Report Abuse |
|
|
KOzero
|
  |
| Joined: 11 May 2010 |
| Total Posts: 1411 |
|
|
| 13 Jul 2014 08:36 AM |
@CodyTheBuildingKid
I know how to use it but from the example I wrote above there is no way to verify the character from the limited info given above unless you have an idea how. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 09:00 AM |
game.Players:GetPlayerFromCharacter(PlayerVariableHere).Character Please give us a more detailed explanation of what you're trying to do with the script. |
|
|
| Report Abuse |
|
|
KOzero
|
  |
| Joined: 11 May 2010 |
| Total Posts: 1411 |
|
|
| 13 Jul 2014 11:26 AM |
local Player = game:GetService("Players"):GetPlayerFromCharacter()
Player.CharacterAdded:connect(function(character) Player.Character.Humanoid.Seated:connect(function() for i,v in pairs(Workspace:GetChildren()) do if v.Name == "Car" then if v.VehicleSeat.Throttle == 1 or 0 then for e,z in pairs (v:GetChildren()) do if z.Name == "Brake" then z.BrickColor = BrickColor.new("Bright red") elseif v.VehicleSeat.Throttle == -1 then z.BrickColor = BrickColor.new("Really red") end end end end end end) end) |
|
|
| Report Abuse |
|
|
KOzero
|
  |
| Joined: 11 May 2010 |
| Total Posts: 1411 |
|
| |
|
|
| 13 Jul 2014 01:57 PM |
You have to have a character to get the player... If you're trying to make this for all players:
Game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(character) Player.Character.Humanoid.Seated:connect(function() for i,v in pairs(Workspace:GetChildren()) do if v.Name == "Car" then if v.VehicleSeat.Throttle == 1 or v.VehicleSeat.Throttle == 0 then for e,z in pairs (v:GetChildren()) do if z.Name == "Brake" then z.BrickColor = BrickColor.new("Bright red") elseif v.VehicleSeat.Throttle == -1 then z.BrickColor = BrickColor.new("Really red") end end end end end end) end)
end) |
|
|
| Report Abuse |
|
|
KOzero
|
  |
| Joined: 11 May 2010 |
| Total Posts: 1411 |
|
| |
|