The code is inside a local script.
Player = game.Players.LocalPlayer local mouse = Player:GetMouse() local interval = 60 local inuse = false mouse.KeyDown:connect(function(key) key = string.lower(key) if string.byte(key) == 113 and inuse == false then inuse = true print(Player.Name) script.Parent.Parent.Character:Clone().Parent = game.Workspace wait(interval) inuse = false end end)
I get the error at script.Parent.Parent.Character:Clone().Parent = game.Workspace
By default characters in Roblox have the property Archivable = false
. Simply set it to true and that should fix your error.
More info here.
Stop using KeyDown to get user input for less errors. use UserInputService. For how long have you used ROBLOX studio and how long without using it? like 2 years? and please use the GetService method to get services, as indexing with (.) to get a service (game.Service) is NO guarantee.
local service = game:GetService(“UserInputService”) local plr = game:GetService(“Players”).LocalPlayer local interval = 60 local inUse = false service.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.Q and inUse == false then inUse = true print(plr.Name) local clone = plr.Character:Clone() clone.Parent = game:GetService(“Workspace”) wait(interval) inUse = false end end)