My rocket launcher script already works, but I’m trying to make the rocket part not explode on teammates. I have tried soo many things, Please help!
(player) is the person who is holding the tool. And
I have already retrieved the player’s team color.
local team = game:GetService("Teams")
local creatorTeamcolor = player.team
this Script creates an explosion if the criteria are met.
local team = game:GetService("Teams")
local creatorTeamcolor = player.team
rocket.Touched:Connect(function(hit)
for i,v in pairs(players:GetPlayers()) do
if hit == v then
if hit ~= handle and not tool.Parent:FindFirstChild(hit.name) and hit.v.team ~= creatorTeamcolor then
local explosion = Instance.new("Explosion")
wait(.03)
explosion.Parent = tool
explosion.Position = rocket.Position
explosion.BlastPressure = 2
explosion.DestroyJointRadiusPercent = 1
rocket.Anchored = true
rocket:Destroy()
end
end
end
end)
end)