Teleport part to player by pressing a letter

Im trying to make a tool when the letter E is pressed it teleports an part into the player.

This was my script but it didnt work:

local UIS = game:GetService(“UserInputService”)
local plr = game.Players.LocalPlayer
local keycode = Enum.KeyCode.E
local tool = script.Parent
local rock = game.Workspace.Rock
local equipped = false
local plrPos = game.Players.LocalPlayer.Vector3

UIS.InputBegan:Connect(function(key, gp)
if key.KeyCode == keycode then
if UIS:GetFocusedTextBox() == nil then
if equipped == true then
rock.Position = Vector3.new(plrPos)
end
end
end

tool.Equipped:Connect(function()
equipped = true
end)
end)

tool.Unequipped:Connect(function()
equipped = false
end)

Thanks for reading!

Try changing this to rock.Position = plr.Character.HumanoidRootPart.Position

1 Like

The Player does not have a Vector3 property.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.