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

Can someone help me with this script?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I'm trying to make this script so you have to be in a certain group AND be on a certain team in the game. This script was given to me so I have no clue how to fix it. This is the script:

debounce = false

script.Parent.Touched:connect(function(hit)
    if (hit) then
        if (hit.Parent) then
            if (game.Players:GetPlayerFromCharacter(hit.Parent)) then
                if (game.Players:GetPlayerFromCharacter(hit.Parent):IsInGroup(387510)) and (game.Playe) then
                    debounce = true
                    script.Parent.Transparency = 0.5
                    script.Parent.CanCollide = false
                    wait(.5)
                    script.Parent.Transparency = 0
                    script.Parent.CanCollide = true
                    debounce = false
                end
            end
        end
    end
end)

1 answer

Log in to vote
1
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago
debounce = false

script.Parent.Touched:connect(function(hit)
    if (hit) then
        if (hit.Parent) then
            if (game.Players:GetPlayerFromCharacter(hit.Parent)) then
            p = game.Players:GetPlayerFromCharacter(hit.Parent)
                if p:IsInGroup(387510) and p.TeamColor == BrickColor.new("Really red") then --teamcolor
                    debounce = true
                    script.Parent.Transparency = 0.5
                    script.Parent.CanCollide = false
                    wait(.5)
                    script.Parent.Transparency = 0
                    script.Parent.CanCollide = true
                    debounce = false
                end
            end
        end
    end
end)

Ad

Answer this question