I want to make a Double Points zone for my game, but i am having trouble scripting this.

The title says everything, i just need a script where as long as your standing on the part you are getting points.

this is the current code i have: `local Debounce = 0

function onTouched(hit)

if Debounce == 0 then
Debounce = 1
local check = hit.Parent:FindFirstChild("Humanoid")

if check ~= nil then

	local user = game.Players:GetPlayerFromCharacter(hit.Parent)
	local stats = user:findFirstChild("leaderstats")

	if stats ~= nil then
		local cash = stats:findFirstChild("Points")
			cash.Value  = cash.Value +1
		wait(1)
	end

end

	Debounce = 0
end

end

script.Parent.Touched:connect(onTouched) `

but it only gives you points if you moving ontop of the part.

I really Would appreciate any help! Thanks!

1 comment

0

I suggest you use region3 which allows you to see what parts are all in a particular location at any given time, you can look this up on youtube or something else. Sorry, but I have no idea about it.