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

How do i make it so as long as your standing on the part you will get points?

Asked by 3 years ago

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!

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. Bankrovers 226 — 3y

Answer this question