So im makeing a Save Bricks Script, and I have the Save Button down, but I need help on the load button...
When a player saves, a Value is created inside there game.Players called Save
Inside Save there are multiple Values Called Part In part, theres a Value called pos and in pos there are 3 values called X , Y, and Z.
There are other things inside part, like the rotation and size but thats not important right now...
Link to the game im working on: http://www.roblox.com/games/272707007/Infinity
local Gui = script.Parent local Player = Gui.Parent.Parent.Parent local Char = Player.Character local save = Player:FindFirstChild("Save") local part = save:FindFirstChild("Part") function onClicked() if save ~= nil then while true do if part ~= nil then local loadpart = Instance.new("Part",game.Workspace) loadpart.Anchored = true loadpart.CFrame = CFrame.new(Vector3.new(part.pos.X,part.pos.Y,part.pos.Z)) end end end Gui.MouseButton1Click:connect(onClicked)
Thank you for reading!
Next time, try to be more specific about what is going wrong. I have looked over your code and your while loop seems to be cause you some problems. First of all, there is no way for the script to get out of the loop, meaning it will sit there trying to spawn parts even if they have all been spawned. Also, there must be a wait inside your while loop otherwise it will crash. Another thing is that local part = save:FindFirstChild("Part")
isn't going to work as it will only find one part, and only spawn that 1 part.
What you have isn't very well written code, so I suggest you use something along the lines of :
function onClicked() if save then for i,v in pairs(save:GetChildren()) do local loadpart = Instance.new("Part",game.Workspace) loadpart.Anchored = true loadpart.CFrame = CFrame.new(Vector3.new(v.pos.X,v.pos.Y,v.pos.Z)) end end end