Don't Gain Time Area Script

Hello, a lot of scripts are functioning well with my game, and I can’t get a script where you don’t gain a leaderstat (time) in a certain area.

Basically, if you are inside of a non-can-collide block, you do not gain time. Your time stays at what it is currently at.

Thanks if anyone can help me!

You could search for it

function isInsideBrick(position, brick)
	local v3 = brick.CFrame:PointToObjectSpace(position)
	return (math.abs(v3.X) <= brick.Size.X / 2)
		and (math.abs(v3.Y) <= brick.Size.Y / 2)
		and (math.abs(v3.Z) <= brick.Size.Z / 2)
end

For the position, you would put the character’s root part’s position

Thanks but I see nowhere in the code you have provided me with that shows you won’t gain a leader stat. I also do not know what to search.

p.s. Nice avatar as well!

In the script where you are adding time, use this function to determine if the player is in the area. If they are, then you just don’t give them time.

Hey, can you please join the game that I messaged you so I can show you? :smile: