local Brick = script.Parent
local function PlayerTouched(Part) if game.Player.Localplayer--- how to see in what team color he is that the only thing i need this for capture points end end
Brick.Touched:connect(PlayerTouched)
local Brick = script.Parent
local function PlayerTouched(Part) if game.Player.Localplayer--- how to see in what team color he is that the only thing i need this for capture points end end
Brick.Touched:connect(PlayerTouched)
###You can get the player in a server script with the GetPlayerFromCharacter method of the Players service. LocalPlayer is nil on the server. We will get the touching part's Parent, which will hopefully be the player's character and not some random model or the workspace.
local Players = game:GetService("Players")
local Brick = script.Parent
local getPlayerFromCharacter
getPlayerFromCharacter = function(model)
return Players:GetPlayerFromCharacter(model)
end
local function PlayerTouched(part)
local plr = getPlayerFromCharacter(part.Parent)
if plr then
plr.TeamColor = BrickColor.new("Bright blue") -- just an example
end
end
Brick.Touched:Connect(PlayerTouched)
If you want to be a brick touched to be a team there is the script:
local Brick = script.Parent
local function PlayerTouched()
game.Players.LocalPlayer.TeamColor = BrickColor.new("Institutional white")
end
Brick.Touched:Connect(PlayerTouched)
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
That won't work, TeamColor isn't a function
oh i will edit it see it works
does this works