why must they do this:
thing is i have no clue why its doing this
code:
rotation code:
if currentattachment and currentattachment:IsA("Attachment") then
local targetcf = grabpack.Model.Gunl2.CFrame:Lerp(CFrame.new(grabpack.Model.rot.Position, currentattachment.WorldPosition), 0.1)
grabpack.Model.Gunl2.CFrame = targetcf
else
local targetcf = grabpack.Model.Gunl2.CFrame:Lerp(grabpack.Model.rot.CFrame, 0.2)
grabpack.Model.Gunl2.CFrame = targetcf
end
(ran in a loop)
shooting code:
if mkey == Enum.UserInputType.MouseButton2 and game.Workspace.values.grabpackupgrade.Value == true then
if oldatt then return end
local function shot()
print("Attempting to shoot")
local waitedtime = 0
oldatt = true
local spot = mouse.Hit.Position
local part = mouse.Target
if part then print("Part found, checking grabable") end
if part:FindFirstChild("Ungrabbable") then
print("NotGrab", part.Name)
oldatt = false
return
end
print("part grabbable")
local lv = grabpack.Model.Gunl2.CFrame.LookVector
local vel = Instance.new("BodyVelocity")
vel.Parent = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart")
vel.MaxForce = Vector3.new(99999,99999,99999)
local at = Instance.new("Attachment")
currentattachment = at
at.Parent = part
at.WorldPosition = spot
grabpack.Model.Gunl2:WaitForChild("beamtop").Beam.Attachment1 = at
local currenttimes = 150
local direction = lv * currenttimes
grabpack.Model.Gunl2.upgrademove:Play()
repeat wait()
game:GetService("TweenService"):Create(game.Workspace.CurrentCamera, TweenInfo.new(0.2), {FieldOfView = direction.Magnitude/2}):Play()
lv = grabpack.Model.Gunl2.CFrame.LookVector
waitedtime += 1
--print(waitedtime)
currenttimes += 1
if currenttimes > 300 then
currenttimes = 300
end
direction = lv * currenttimes
vel.Velocity = direction
until (game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart").Position - spot).Magnitude < 10 or waitedtime > 150
grabpack.Model.Gunl2.upgrademove:Stop()
grabpack.Model.Gunl2:WaitForChild("beamtop").Beam.Attachment1 = nil
at:Destroy()
vel:Destroy()
currentattachment = nil
oldatt = false
end
local co = coroutine.create(shot)
coroutine.resume(co)
end
model tree for anyone wondering:
i dont know why it is doing this i dont understand