i am trying to make a script that adds a part after deleting a part by pressing the "delete" key ,this is in a local script
local UserInputService = game:GetService("UserInputService") local part = game.Workspace.Part UserInputService.InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.Delete then part:Destroy() end end)
thank you
--[[ make an event that fires when it destroys ]] local UserInputService = game:GetService("UserInputService") UserInputService.InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.Delete then local part = game.Workspace:FindFirstChild'Part' or nil if part then part:Destroy() game.ReplicatedStorage.Events.RemakePart:FireServer() end end end) --[[ put this in a server script somewhere ]] game.ReplicatedStorage.Events.RemakePart.OnServerEvent:Connect(function() Instance.new('Part', game.Workspace).Position = Vector3.new(0,0,0) -- make part and put position u want end)