I haven't fiddled with Data Store that much and I'm terrible at anything to do with BrickColors but I'm still pretty unsure why this is broken The main parts of the script are:
doba = script.Parent.Parent.Parent script.Parent.Parent.Parent:WaitForDataReady() ds = game:GetService("DataStoreService"):GetGlobalDataStore() color = ds:GetAsync(player.userId .."currentpants") or nil -- problem occurs around here if color == nil then ds:SetAsync(player.userId .."currentpants",tostring(script.Parent.Parent.Parent.stats.lleg.Value)) color = tostring(script.Parent.Parent.Parent.stats.lleg.Value) -- should be bright blue end script.Parent.Parent.Parent.stats.lleg.Value = BrickColor.new(color) script.Parent.Parent.Parent.stats.rleg.Value = BrickColor.new(color)
rleg & lleg are BrickColorValues
Any solutions?
EDIT: changed
color = ds:GetAsync(player.userId .."currentpants") --to color = ds:GetAsync(player.userId .."currentpants") or nil
still broken!
I asked a similar question a little bit ago.
It turns out, GetAsync doesn't return nil
when called for an empty key. In fact, it literally returns nothing at all.
To fix this, change line 5 to this:
color = ds:GetAsync(player.userId .."currentpants") or nil
That creates a default value to work with.
Also, you can't test DataStores using a Test Server, you have to do it on a live server from the Play button.