Hello everyone,
I hope you are doing well. I’ve gotten to this problem where i have a hammer which is moved by tweens. Its a moderately complex script, and as shown in the video, i unanchor the hammer at the end of all the tweens, causing it to drop. What i dont understand is why there is a pause, or why it looks so unnatural. Should i apply a force of some kind in the movement direction to make it more realistic? Any constructive help is appreciated.
Thanks!
(EDIT: The video is just showing grey under the ui, so im sorry i cant provide some visual prompts, but i am happy to elaborate if needed.)
local cooldownVal = plr.Character:FindFirstChild("Cooldowns") and plr.Character.Cooldowns:FindFirstChild("Q")
cooldownVal.Value = cooldowns["Q"]
local hammer = game.ServerStorage.Assets.Hammer:Clone()
hammer.Parent = char
holdEvent:FireClient(plr, "a", keybind)
holdEvent.OnServerEvent:Connect(function(plr, pos1, pos2, pos3)
local folder
local bezierParts = {}
local function lerp(t, a, b)
return a + (b - a) * t
end
local function quadBezier(t, p0, p1, p2)
local l1 = lerp(t, p0, p1)
local l2 = lerp(t, p1, p2)
local quad = lerp(t, l1, l2)
return quad
end
local function createCurve()
if game.Workspace:FindFirstChild("CurveParts") == nil then
folder = Instance.new("Folder")
folder.Name = "CurveParts"
folder.Parent = game.Workspace
else
folder = game.Workspace.CurveParts
end
for i = 0, 1, 0.01 do
local quad = quadBezier(i, pos1, pos2, pos3)
local part = Instance.new("Part")
part.Anchored = true
part.CanCollide = false
part.BrickColor = BrickColor.new("Really red")
part.Transparency = 1
part.Size = Vector3.new(0.5, 0.5, 0.5)
part.CFrame = CFrame.new(quad)
part.Parent = folder
table.insert(bezierParts, part)
end
end
createCurve()
local grip = char:FindFirstChild("RightGrip", true)
if grip then grip:Destroy() end
local handle = hammer.Handle
handle.Parent = workspace.Assets.Projectiles
hammer:Destroy()
handle.Anchored = true
handle.CanCollide = false
for i, v in bezierParts do
local currentRot = handle.CFrame - handle.Position
local targetCF =
CFrame.new(v.Position) *
currentRot *
CFrame.Angles(0, math.rad(-8), 0)
local throwTween = game:GetService("TweenService"):Create(
handle,
TweenInfo.new(0.006, Enum.EasingStyle.Linear),
{CFrame = targetCF}
)
throwTween:Play()
if i ~= #bezierParts then throwTween.Completed:Wait() end
end
handle.Anchored = false
handle.CanCollide = true
task.wait(3)
handle:Destroy()
end)