generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: ServerScriptService. RPGMain. SaveCharacterStats:93: bad arg

Previous Thread :: Next Thread 
Tynexx is not online. Tynexx
Joined: 11 Jul 2012
Total Posts: 1559
18 Jul 2014 02:10 AM
Around there, there is:
for i,v in pairs(p.CharacterStats.HairStyle:GetChildren()) do
if Auto_Load then
if v.className=="Vector3Value" then
v.Value = Vector3.new(DataStore:GetAsync(v.Name))
elseif v.className=="CFrameValue" then
v.Value = CFrame.new(DataStore:GetAsync(v.Name))
elseif v.className=="BrickColorValue" then
v.Value = BrickColor.new(DataStore:GetAsync(v.Name))
else
v.Value=DataStore:GetAsync(v.Name)

end end end

In another script, I try doing this game.Workspace.Players.Player1.CharacterStats.HairStyle_Scale.Value = Vector3.new(1.05,1.05,1.05)
~Tynexx
Report Abuse
Tynexx is not online. Tynexx
Joined: 11 Jul 2012
Total Posts: 1559
18 Jul 2014 02:23 AM
bump
~Tynexx
Report Abuse
Tynexx is not online. Tynexx
Joined: 11 Jul 2012
Total Posts: 1559
18 Jul 2014 02:26 AM
Fixed! CFrame.new(Vector3.new())
~Tynexx
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
18 Jul 2014 03:19 AM
How are you saving/loading everything?
Report Abuse
Tynexx is not online. Tynexx
Joined: 11 Jul 2012
Total Posts: 1559
18 Jul 2014 12:58 PM
I am saving it with DataStore.. Why?
~Tynexx
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
18 Jul 2014 01:30 PM
I mean.

Is it saved as "X, Y, Z", {X, Y, Z}, {x = X, y = Y, z = Z}?
Report Abuse
Tynexx is not online. Tynexx
Joined: 11 Jul 2012
Total Posts: 1559
18 Jul 2014 01:44 PM
X,Y,Z
~Tynexx
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
18 Jul 2014 01:44 PM
A string?
Report Abuse
Tynexx is not online. Tynexx
Joined: 11 Jul 2012
Total Posts: 1559
18 Jul 2014 03:49 PM
CFrameValue
~Tynexx
Report Abuse
Tynexx is not online. Tynexx
Joined: 11 Jul 2012
Total Posts: 1559
18 Jul 2014 03:54 PM
And no
~Tynexx
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
18 Jul 2014 04:02 PM
You might not be able to do what you are doing. You might have to store it as a table which you then unpack.
Report Abuse
Tynexx is not online. Tynexx
Joined: 11 Jul 2012
Total Posts: 1559
18 Jul 2014 06:49 PM
Oh really? Why?
~Tynexx
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
18 Jul 2014 06:53 PM
IDK if it can save CFrames or Vector3s.
Report Abuse
Tynexx is not online. Tynexx
Joined: 11 Jul 2012
Total Posts: 1559
18 Jul 2014 06:55 PM
I'll google then.
~Tynexx
Report Abuse
Tynexx is not online. Tynexx
Joined: 11 Jul 2012
Total Posts: 1559
18 Jul 2014 06:57 PM
Your right,
'Values can be numbers, booleans, strings, or Lua tables. However, values cannot be ROBLOX types like Vector3, Instance, or Part.'
I'll save it with tables then.
~Tynexx
Report Abuse
Tynexx is not online. Tynexx
Joined: 11 Jul 2012
Total Posts: 1559
18 Jul 2014 07:25 PM
I have no idea if I'm doing this right:
statsname = "CharacterStats"
local strings = {"HairStyle_MeshId","Face_Texture"}
local cframes = {"HairStyle_CFrame"}
local vector3s = {"HairStyle_Scale"}
local colors = {"Skin","HairStyle_Color"}
local DS = game:GetService("DataStoreService"):GetDataStore("CharacterStats")
game.Players.PlayerRemoving:connect(function(p)
DS:UpdateAsync(plr.userId, function()
values = {}
values[1]=bag.HairStyle_MeshId.Value
values[2]=bag.HairStyle_CFrame.Value
values[3]=bag.HairStyle_Scale.Value
values[4]=bag.Face_Texture.Value
values[5]=bag.Skin.Value
values[6]=bag.HairStyle_Color.Value
end)
end)
game.Players.PlayerAdded:connect(function(p)
if not (DS:GetAsync(plr.userId)) then
DS:SetAsync(plr.userId, {})
end
local valuesDS = DS:GetAsync(p.userId)

local box = Instance.new("Model", p)--Sets where stats are.
box.Name = statsname
for i,v in pairs(strings) do --Insert Strings.
local currency = Instance.new("StringValue",box)
currency.Name = v
end
for i,v in pairs(cframes) do--Insert CFrameValues
local currency = Instance.new("CFrameValue",box)
currency.Name = v
end
for i,v in pairs(vector3s) do--Insert Vector3Values
local currency = Instance.new("Vector3Value",box)
currency.Name = v
end
for i,v in pairs(colors) do--Insert BrickColorValues
local currency = Instance.new("BrickColorValue",box)
currency.Name = v
end
--Give them there values
local bag = p:FindFirstChild(statsname)
if bag then
bag.HairStyle_MeshId.Value = valuesDS[1]
bag.HairStyle_CFrame.Value = CFrame.new(valuesDS[2])
bag.HairStyle_Scale.Value = Vector3.new(valuesDS[3])
bag.Face_Texture.Value = valuesDS[4]
bag.Skin.Value = BrickColor.new(valuesDS[5])
bag.HairStyle_Color.Value = BrickColor.new(valuesDS[6])
end
while wait(60) do
valuesDS[1]=bag.HairStyle_MeshId.Value
valuesDS[2]=bag.HairStyle_CFrame.Value
valuesDS[3]=bag.HairStyle_Scale.Value
valuesDS[4]=bag.Face_Texture.Value
valuesDS[5]=bag.Skin.Value
valuesDS[6]=bag.HairStyle_Color.Value
end
end)
~Tynexx
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image