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

Why it won't kill enemy team player if he touched owner door? [closed]

Asked by 7 years ago

Hello, i have problem with this script. Enemy team player should die when he touch owner door in another team. I mean in script it says that it will kill every player, which are not in my team. Anyway it's owner door script to tycoon.

v = script.Parent.Parent.Value
click = script.Parent.ClickDetector

function wat(player)
    local character = game.Players:GetPlayerFromCharacter(player.Parent)
    if player.TeamColor == script.Parent.Parent.Parent.Parent.TeamColor.Value then
        if v.Value == true then
            v.Value = false
            script.Parent.BrickColor = BrickColor.new("Bright red")
            for i,v in pairs(script.Parent.Parent.Lasers:GetChildren()) do
                v.BrickColor = BrickColor.new("Bright green")
                v.Transparency = .8
                v.CanCollide = false
            end

        elseif v.Value == false then
            v.Value = true
            script.Parent.BrickColor = BrickColor.new("Bright green")
            for i,v in pairs(script.Parent.Parent.Lasers:GetChildren()) do
                v.BrickColor = BrickColor.new("Bright red")
                v.Transparency = .3
                v.CanCollide = true
                if player.Parent:FindFirstChild("Torso") then
                    local exp = Instance.new("Explosion")
                    exp.BlastRadius = 3
                    exp.Position = player.Position
                    exp.Parent = workspace
                    print("added explosion")
                    if player.Parent:FindFirstChild("Humanoid") then
                        player.Parent.Humanoid.Health = 0
                        print("killed")
                    end
                end
            end

        end
    end
end

click.MouseClick:connect(wat)
1
Erm, you say when they touch, but its bound by a click detector. Please make sure you know what you're doing when posting a script. Simpfully asking things about free models / asking to fix free models isn't what this site is for. RubenKan 3615 — 7y

Closed as Not Constructive by Goulstem

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?