Player = game:GetService('Players').LocalPlayer
mouse = Player:GetMouse()
function onKeyDown(key)
key = key:lower()
if key == "z" then
print("Success")
Instance.new("Part")
game.Workspace.Part.Parent = workspace
game.Workspace.Part.CFrame = CFrame.new(10.184, 2.5, -20.017)
game.Workspace.Part.Name = "Brick1"
end
end
mouse.KeyDown:connect(onKeyDown)
This script is supposed to create a new part when I press Z (And rename the Part "Brick1"
but it returns with the output Part is not a valid member of Workspace
AND I DONT KNOW WHY

1 comment
You never defined what part was, so on line 9 the script does not know what to parent.