Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why wont this :SavePlace() code work?

Asked by
Dr_Doge 100
9 years ago

The code is meant to make it so that that all the parts in Workspace Called "Part" get saved whenever you press z on your keybord.


Player = game.Players.LocalPlayer mouse = Player:GetMouse() mouse.KeyDown:connect(function(key) if key == "z" then local c = game.Workspace:GetChildren() for i = 1, #c do if (c[i].Name == "Part") then c[i]:SavePlace(Enum.SaveFilter.SaveAll) end end end end)

Thank you

0
KeyDown doesn't return a string, it returns a number equivalent to the key's byte value. Instead of comparing key to z, compar key to "z":byte() aquathorn321 858 — 9y
0
@aquathorn321 No, keydown returns a string. It's deprecated though, so it shouldn't really be used. RepeatLua 90 — 9y
0
I know the Keyboard Script works. Ive tested it on other stuff. Its the SavePlace() Thing I cant get to work... Dr_Doge 100 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

From my understanding, You cannot use :SavePlace() in local scripts?

Ad

Answer this question