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

Why wont this :SavePlace() code work?

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

3 comments

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()

0

@aquathorn321 No, keydown returns a string. It's deprecated though, so it shouldn't really be used.

0

I know the Keyboard Script works. Ive tested it on other stuff. Its the SavePlace() Thing I cant get to work...

1 answer

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

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