|
So what I want is
> player touch brick and identify what team player is on
But I want to use a regular script
How would I go about doing this? |
|
|
script.Parent.Touched:connect(function(hit)
local hasHumanoid = hit.Parent:FindFirstChild("Humanoid");
local player = hasHumanoid and game:GetPlayersFromCharacter(hit.Parent);
if playerthen
local teamColor = player.TeamColor;
print(teamColor);
end
end);
Matthew is my little PF snake. |
|
PyracelJoin Date: 2013-07-21 Post Count: 3207 |
brick.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local Player = hit.Parent:GetPlayerFromCharacter()
print(Player.TeamColor)
end
end)
Somethijng like that, if anyone would edit my code that would be gr8. |
|
|
@Cease
GetPlayersFromCharacter is not a valid member of DataModel |
|
|
Whoops, game.Players:GetPlayerFromCharacter(hit.Parent), sorry.
Matthew is my little PF snake. |
|
PyracelJoin Date: 2013-07-21 Post Count: 3207 |
...I does it correctly, gets no credit... |
|
|
You should expect nothing back if you're going to help someone. Give more, expect less.
Matthew is my little PF snake. |
|
|
Also, no you didn't. Yours would error.
Matthew is my little PF snake. |
|
|
Alright thank you all!
Cease nice to see you again :) |
|
|
Uh.. shouldn't this work?
main.Touched:connect(function(hit)
local hasHumanoid = hit.Parent:FindFirstChild("Humanoid")
local player = hasHumanoid and game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if player.TeamColor == "Black" then
print("hello")
end
end
end)
|
|
OslayisJoin Date: 2016-02-24 Post Count: 73 |
Try this;
main.Touched:connect(function(hit)
local hasHumanoid = hit.Parent:FindFirstChild("Humanoid")
local player = hasHumanoid and game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if player.TeamColor == BrickColor.new("Black") then
print("hello")
end
end
end)
|
|
|