local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local position
mouse.Move:connect(function(hit)
position = mouse.hit.p
end)
local UIS = game:GetService("UserInputService")
UIS.InputBegan:connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.Z then
local TeleportLocation = CFrame.new(position)
local Character = player.Character
if (Character.Position - mouse.position).Magnitude > 100 then
Character:SetPrimaryPartCFrame(TeleportLocation)
else
print ("Too far away")
end
end
end)
what im trying to do is basically get the position of smth using the mouse and teleport my player to the mouse. however an error shows that says 'Position is not a valid member of Workspace.Joseph_Joku please help!
