Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can someone help me with this script?

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

✓ Accepted answer
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)

This discussion is preserved as it was. New answers, comments, and votes are closed.