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

Why do not the data load correctly? [SOLVED]


function inputDataToPlayer(player, dataTable)
    if dataTable ~= nil then
	
	for alldata,currentdata in pairs (dataTable) do
		local Part = game.ServerStorage.Part:Clone()
		Part.Parent = game.Workspace.PlayerBase.Objects
		Part.Name = (currentdata["Name"])
		Part.Position = (Vector3.new( currentdata["PositionX"],currentdata["PositionY"],currentdata["PositionZ"]))
		Part.BrickColor = (BrickColor.new((currentdata["Color"])))
		Part.Material = (string.sub(currentdata["Material"],15,-1))
		print (string.sub(currentdata["Material"],15,-1))
	end

end


I fixed it!

for some reason i cant create a Vector3 out of one Position Value i have to use PositionX,Y and Z

3 comments

0

When you do variable = 1, 2, 3. The '2, 3' are discarded, and variable is assigned to 1.

0

just use vector3 and color3 values for color and position

0

You cannot store userdata in data stores. Or maybe not directly, however I don't think you can at all

1 answer

Hello again, MageMasterHD!

You don't need to do nothing with the datas(if you didn't changed the script)

function inputDataToPlayer(player, dataTable)
    if dataTable ~= nil then

    for data,currentdata in pairs (dataTable) do
        local Part = game.ServerStorage.Part:Clone()
        Part.Parent = game.Workspace.PlayerBase.Objects
        Part.Name = currentdata[data]["Name"] --This is a String
        Part.Position = currentdata[data]["Position"] --This is a Vector3
        Part.Color = currentdata[data]["Color"] --This is a Color3
        Part.Material = currentdata[data]["Material"] --This is a Material
    end

end

You also forgot to add the index...

Next question, please add all the scripts related to it, like the data saving one

Good Luck with your games

1 comment

0

it tells me (Vector3 expected, got string)

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