I'm trying to make a script that creates a part when the "R" key is pressed.
Everything works fine except that the part's position would not go on top of the character's head.
local baseplate = workspace.Baseplate
local player = game.Players.LocalPlayer
local character = player.Character
if not character or character.Parent then
character = player.CharacterAdded:wait()
print(character)
end
local function Fire(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
local part = Instance.new("Part")
part.Parent = workspace
print(character)
part.Position = Vector3.new(character.Head)
-- How can you also add an offset so the part is 10 units above the character's head?
end
end
game.ContextActionService:BindAction("ChangeColor", Fire, false, Enum.KeyCode.R)

1 comment
Thank you for the help!