I'm relatively new to scripting, and I'm trying to make it so once the player presses "Q" on their keyboard, a part appears in front of them. For some reason, when I press Q, it only appears in the game, but not in front of the player, but rather at the center of the map (or the spawn point of the baseplate.) could anybody help? Here's the script I used.
local player = game.Players.LocalPlayer
local character = player.character
local mouse = player:GetMouse()
local enabled = true
mouse.KeyDown:Connect(function(key)
if key == "q" then
print("Pressed Q")
local part = Instance.new("Part", game.Workspace)
part.CanCollide = true
part.newCFrame = character.Torso.CFrame*CFrame.new(0,0,-5)
end
end)
