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

When someone hits the brick with their rocket launcher their get points help?

Asked by 4 years ago
waittime = 5 -- Time Between each hit
amnt = 5 --how much you get for it
function onTouched(part)
    local h = part.Parent:findFirstChild("Humanoid")
    if (h~=nil) then
        local thisplr = game.Players:findFirstChild(h.Parent.Name)
        if (thisplr~=nil) then
            local stats = thisplr:findFirstChild("leaderstats")
            if (stats~=nil) then
                local score = stats:findFirstChild("Points")
                if (score~=nil) then
                    score.Value = score.Value + amnt
                end
            end
        end

        script.Parent.Transparency = 0.5
        script.Disabled = true
        wait(waittime)
        script.Parent.Transparency = 0
        script.Disabled = false     


    end
end

script.Parent.Touched:Connect(onTouched)

Answer this question