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

How to make the points permanent?

Asked by 8 years ago

I have a point giving script and what would be the correct script to add to this so that when a player leaves and rejoins, the points that are given from this part are still there. Currently, when you leave, you will lose all of the points that you got from this part. How would I make the points not go away?

local ting = 0

function onTouched(hit)

    if ting == 0 then 
    ting = 1
    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  +5 
        wait(0.1) 
        end 

    end 

    ting = 0
    end 

end 

script.Parent.Touched:connect(onTouched)

1 answer

Log in to vote
1
Answered by 8 years ago

Use a DataStore, here is the Wiki: http://wiki.roblox.com/index.php?title=Data_store

Hope I helped :)

Ad

Answer this question