Try changing this to “transform” and see if that changes anything. If not, let us know.
You named your saved value “tramsform” but you’re trying to index “transform”.
Same error. Also I’d like to note the tutorial is over 2 years old
ServerScriptService.TycoonDataManager:90: attempt to index nil with 'x' - TycoonDataManager:90
Stack Begin
Script 'ServerScriptService.TycoonDataManager', Line 90 - function deserialize - TycoonDataManager:90
Script 'ServerScriptService.TycoonDataManager', Line 121 - TycoonDataManager:121
Stack End
Well, fixing the name of the saved value is only going to change what gets saved from now on, you still have a datastore full of stored tables with a “tramsform” entry. You have to check saved data for both, by trying to read both and checking for nil before trying to access x,y,z, and r. Then, resave the user’s data with the key name fixed.
If you can possibly provide edited code that would be great, I’m not the best programmer and this is all following a tutorial.
try this instead
loadedModel:SetPrimaryPart(CFrame.new(saved.tramsform.x, saved.tramsform.y, saved.tramsform.z)*CFrame.Angles(0, math.rad(saved.tramsform.r), 0))
SetPrimaryPart is not a valid member of Model "Part" - TycoonDataManager:90
Stack Begin
Script 'ServerScriptService.TycoonDataManager', Line 90 - function deserialize - TycoonDataManager:90
Script 'ServerScriptService.TycoonDataManager', Line 121 - TycoonDataManager:121
Stack End
(you could also SetPrimaryPartCFrame but thats deprecated)
loadedModel:PivotTo(CFrame.new(saved.tramsform.x, saved.tramsform.y, saved.tramsform.z)*CFrame.Angles(0, math.rad(saved.tramsform.r), 0))
It worked 1 time but after reloading into the game I get
ServerScriptService.TycoonDataManager:90: attempt to index nil with 'x' - TycoonDataManager:90
Stack Begin
Script 'ServerScriptService.TycoonDataManager', Line 90 - function deserialize - TycoonDataManager:90
Script 'ServerScriptService.TycoonDataManager', Line 121 - TycoonDataManager:121
Stack End
put this
print(saved)
before you PivotTo
then send results from output here (make sure to expand the table if its collapsed)
table: 0xbf3698f1b06f0f55
what does this mean
but inside roblox studio not roblox player
So I run it inside roblox player?
run in roblox studio and this is what i get after printing table in roblox studio
if that still doesnt work just
table.foreach(saved,print)
By printing table do you mean printing 0xbf3698f1b06f0f55?
Also table.foreach is deprecated
i dont know why do you get memory address instead of what i got in my roblox studio output (as i show on my screenshot)
table.foreach should print every each value inside that table if you did something like this table.foreach(table,print) this will print every each function inside table so like table.freeze, table.clear etc
in your case those are supposed to be values like string and cframe inside of transform
in short terms put this
table.foreach(saved,print)
because im trying to figure out what is inside of “saved” table
This is what i get from table.foreach
transform table: 0x113e5321f7bf26a9
alright how about this
if saved.tramsform then
loadedModel:PivotTo(CFrame.new(saved.tramsform.x, saved.tramsform.y, saved.tramsform.z)*CFrame.Angles(0, math.rad(saved.tramsform.r), 0))
elseif saved.transform then
loadedModel:PivotTo(CFrame.new(saved.transform.x, saved.transform.y, saved.transform.z)*CFrame.Angles(0, math.rad(saved.transform.r), 0))
else
warn("nothing was done")
table.foreach(saved,print)
end
thank you so much saving works now
it just printed either nothing or nil when i loaded
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.