Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make a gun unable to do friendly damage? [closed]

Asked by 4 years ago

the title says it all, i have this damage script:

local function playerCheck(hit, plyr)
    local playerTouched = hit.Parent.Name
    local playerTouched2 = players:FindFirstChild(playerTouched)
    local humanoid = hit.Parent:FindFirstChild("Humanoid")
    local plyr = game.Players:GetPlayerFromCharacter(hit.Parent)
    if humanoid and humanoid.Parent.Name ~= bullet.Attacker.Value then
        humanoid:TakeDamage(33.5)
        bullet:Destroy()
    elseif not hit.Parent:FindFirstChild("Humanoid") and hit.Name ~= "Handle" and 
        hit.Parent.Name  ~= bullet.Attacker.Value then
        bullet:Destroy()
    end
end
bullet.Touched:Connect(playerCheck)

And i have some teams so how do i make players of the same team get damaged?

Closed as Not Constructive by Leamir

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?