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

DribbleValue Value is automatically set to the amount of Dribbles the user has on joining?

Asked by 5 years ago

https://gyazo.com/e94f40df0b5ef8d53126e97a57c19634

I'm creating a click simulator where you click and you gain "Dribbles" which are points pretty much.

My problem is that every time I join the server it gives DribbleValue the value of the amount of dribbles you have.

Which DribbleValue is an IntValue that is the amount of dribbles you get per click.

local DATA_STORE = game:GetService("DataStoreService")
local DS2 = DATA_STORE:GetDataStore("DribbleSaveSystem")
local DS3 = DATA_STORE:GetDataStore("SpeedSaveSystem")
local DS4 = DATA_STORE:GetDataStore("DelaySaveSystem")



game.Players.PlayerAdded:Connect(function(plr)
    local folder = Instance.new("Folder", plr)
    folder.Name = "StatValues"

    local dribble_value = Instance.new("IntValue", folder)
    dribble_value.Name = "DribbleValue"

    local speed_value = Instance.new('StringValue', folder)
    speed_value.Name = "SpeedValue"

    local delay_value = Instance.new('StringValue', folder)
    delay_value.Name = "DelayValue"

    dribble_value.Value = DS2:GetAsync(plr.UserId) or 0
    DS2:SetAsync(plr.UserId, dribble_value.Value)

    dribble_value.Changed:Connect(function()
        DS2:SetAsync(plr.UserId, dribble_value.Value)
    end)


    speed_value.Value = DS3:GetAsync(plr.UserId) or 0
    DS3:SetAsync(plr.UserId, speed_value.Value)

    speed_value.Changed:Connect(function()
        DS3:SetAsync(plr.UserId, speed_value.Value)
    end)    


    delay_value.Value = DS4:GetAsync(plr.UserId) or 0
    DS4:SetAsync(plr.UserId, delay_value.Value)

    delay_value.Changed:Connect(function()
        DS4:SetAsync(plr.UserId, delay_value.Value)        
    end)    

end) 

Answer this question