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

DataStore Issue : Date wont save?

Asked by 7 years ago
CustomStore = game:GetService("DataStoreService"):GetDataStore("DataStore")

function PlayerEntered(player)

        local helm = Instance.new("StringValue")
        helm.Parent = group
        helm.Name = "Helm"
------------------------------------------------   
        if CustomStore:GetAsync("Helm_"..player.Name) ~= nil then
                helm.Value = CustomStore:GetAsync("Helm_"..player.Name)
        else
                helm.Value = "Really red"
        end

        helm.Changed:connect(function(Val)
                CustomStore:SetAsync("Helm_"..player.Name, Val)
        end)
------------------------------------------------
end

game.Players.PlayerAdded:connect(PlayerEntered)

This is my script. For some reason, it creates the string value, says "Oh. it's got a value already" (changed from "Really red" to "Really blue"), But won't save NEW changes?

anyone got any ideas?

0
Should user player.UserId instead of player.Name because name can change but UserId can't blowup999 659 — 7y
0
okay, but will that change the fact that new values dont save? FrozenWinterz 50 — 7y
0
Sorry, that sounded rude. Thank you for your advice, i'm pretty sure that'd REALLY screw over some save files. so thanks! FrozenWinterz 50 — 7y
0
I don't see anything wrong with the script that would cause it to not save blowup999 659 — 7y
View all comments (2 more)
0
hmm. maybe it's the changing of it? FrozenWinterz 50 — 7y
0
Did you try confirming that it's running helm.Changed with a print inside of it? blowup999 659 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
local player = game.Players.LocalPlayer
function onClicked()
    player.Customisations.Helm.Value = "Lime green"
end
script.Parent.MouseButton1Down:connect(onClicked)

CONTEXT This is in a LocalScript, Inside TextButton, Inside a Frame, Inside a ScreenGUI, Inside StarterGui.

0
You could have just put that in an edit in the original question blowup999 659 — 7y
0
i appologise, i didn't think it was needed. FrozenWinterz 50 — 7y
0
But Yes. Helm:Changed is recognised. FrozenWinterz 50 — 7y
Ad

Answer this question