Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

DataStore Issue : Date wont save?

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?

6 comments

0

Should user player.UserId instead of player.Name because name can change but UserId can't

0

okay, but will that change the fact that new values dont save?

0

Sorry, that sounded rude. Thank you for your advice, i'm pretty sure that'd REALLY screw over some save files. so thanks!

0

I don't see anything wrong with the script that would cause it to not save

0

hmm. maybe it's the changing of it?

0

Did you try confirming that it's running helm.Changed with a print inside of it?

1 answer

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.

3 comments

0

You could have just put that in an edit in the original question

0

i appologise, i didn't think it was needed.

0

But Yes. Helm:Changed is recognised.

This discussion is preserved as it was. New answers, comments, and votes are closed.