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)
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)