local Mouse = game.Players.LocalPlayer:GetMouse()
local PickForce = Instance.new('BodyPosition')
PickForce.P = 100000
PickForce.D = 7000
local TargetObject = nil
game["Run Service"].RenderStepped:connect(function()
PickForce.position = Vector3.new(game.Players.LocalPlayer.Character.Torso.Position.X, game.Players.LocalPlayer.Character.Torso.Position.Y, game.Players.LocalPlayer.Character.Torso.Position.Z * 5)
end) -- Need help in this function
Mouse.Button1Down:connect(function()
if Mouse.Target then
local p = Mouse.Target
if (game.Players.LocalPlayer.Character.Torso.Position - p.Position).magnitude <= 30 then
PickForce.Parent = p
else
PickForce.Parent = nil
end
else
PickForce.Parent = nil
end
end)
This script is intended to imitate the ability to lift objects in horror games. I am having lots of trouble finding a good algorithm for the bodyposition.
I only need help with the positioning, I will fix a few direct references to the character soon.
