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

How do I make a hold down timer for capture points?

Hello, I've been working on a game and the main gameplay is to capture flag points but the problem is that you capture the point instantly without needing to wait. I was wondering how I can modify the script I have.

Thanks.

Other Info:

The script is a normal script inside model inside workspace

Script:

local team = game.Teams["US Armed Forces"]
local open = false

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:findFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if not open then
			if player.Team == team then
				script.Parent.CanCollide = false
				for i = 1, 8 do
					script.Parent.Parent.American.Transparency = 0
					script.Parent.Parent.Non.Transparency = 1
					script.Parent.Parent.German.Transparency = 1
					script.Parent.Parent.PointTextPart.B.Enabled = true
					script.Parent.Parent.PointTextPart.N.Enabled = false
					script.Parent.Parent.PointTextPart.G.Enabled = false
					game.Workspace.APoint.Value = 1
					wait(2)				
				end								
			end			
		else			
			if player.Team ~= team then				
				player.Character.Humanoid.Health = 0				
			end			
		end		
	end	
end)

2 comments

0

can you explain it further? Do you want the player to touch the part and get points or overtime they get points?

0

Well for example battlefield 1. In the game when your on a capture point you have too defend the point before it has been captured by your team.

1 answer

✓ Accepted answer

I do not really get what you mean by "capturing points" I understood it like that: You want transparency of Non and German 1 when its fully captured, We dont know what you want to do. I tried to help in a way I understood it, so I hope I understood it right:

local team = game.Teams["US Armed Forces"]
local open = false

script.Parent.Touched:Connect(function(hit)
    if hit.Parent:findFirstChild("Humanoid") then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if not open then
            if player.Team == team then
                script.Parent.CanCollide = false
                script.Parent.Parent.American.Transparency = 0
                for i = 0, 1, 0.1 do
                    script.Parent.Parent.Non.Transparency = i
                    script.Parent.Parent.German.Transparency = i
                    wait(1)             
                end
                script.Parent.Parent.PointTextPart.B.Enabled = true
                script.Parent.Parent.PointTextPart.N.Enabled = false
                script.Parent.Parent.PointTextPart.G.Enabled = false
                game.Workspace.APoint.Value = 1                 
            end         
        else            
            if player.Team ~= team then             
                player.Character.Humanoid.Health = 0                
            end         
        end     
    end 
end)

1 comment

0

Well basically Control points is the official term I looked up for gamemodes like conquest in battlefield or other games where you hold the point while defending it for your team after that the point is fully captured on to your team. Thanks though and sorry I'm bad at explaining sometimes

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