So im trying to make a "Save Blocks" Script, but i came across this problem.
when I run the script/press the button, inside Player, theres a Value called Save and in Save theres a Value Called Part, and inside Part theres a Value called pos, but pos has no value, so im gessing that .Value = ""..part.Position.."" is wrong. Can someone explain why it wont work?
local Gui = script.Parent local Player = Gui.Parent.Parent.Parent local Char = Player.Character local part = game.Workspace:FindFirstChild("Part") function onClicked() local save = Instance.new("StringValue", Player) save.Name = "Save" while true do wait() if part ~= nil then local savepart = Instance.new("StringValue", save) savepart.Name = "Part" local savepartpos = Instance.new("StringValue", savepart) savepartpos.Name = "pos" savepartpos.Value = ""..part.Position.."" local savepartrot = Instance.new("StringValue", savepart) savepartrot.Name = "rot" savepartrot.Value = ""..part.Rotation.."" local savepartsize = Instance.new("StringValue", savepart) savepartsize.Name = "size" savepartsize.Value = ""..part.Size.."" part:remove() end end end Gui.MouseButton1Click:connect(onClicked)
If you want a string representation, you should just use tostring(part.Position)
.
Concatenation has to be specifically defined -- it doesn't automatically turn objects into strings when concating with a string. Since it wasn't for Vectors, you get an error.
It makes a lot more sense to use Vector3Value
s, though, since that way you can actually get the value back later without doing an excessive amount of work.