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!
The issue is that Character (A model) does not have a Position property. You will want to use their RootPart instead, which can be accessed with Character.PrimaryPart
. Alternatively you could do Character.HumanoidRootPart
or access their Head and any of their body parts. You can look up the parts by using the explorer