I am trying to make something where if a player hits a ball with here tool it goes to a part and if the player is one the other team it goes to the other part.
I need help with the team names
-- SERVER SCRIPT INSIDE HANDLE
---> services
local TweenService = game:GetService("TweenService")
local Teams = game:GetService("Teams")
---> variables
local ball = game.Workspace:WaitForChild("Ball")
local hitparts = script.Parent
local opart = game.Workspace:WaitForChild("O")
local bpart = game.Workspace:WaitForChild("B")
local TeamB = "Blue"
---> main
hitparts.Touched:Connect(function(hit)
local character = hitparts.Parent
local player = game.Players:GetPlayerFromCharacter(character)
if player.Team.Name == TeamB then
ball.CFrame = CFrame.new(opart.Position)
else
ball.CFrame = CFrame.new(bpart.Position)
end
end)