Motor6D C0 & C1 Math
Once a player triggers a proximity prompt,
I want the model to tween towards my right hand.
local tweenservice = game:GetService("TweenService")
function Can_Collide(Parent, Bool)
if Parent:IsA("Model") or Parent:IsA("Folder") then
for _, Basepart in pairs(Parent:GetDescendants()) do
if Basepart:IsA("BasePart") then
Basepart.CanCollide = Bool
end
end
end
end
function Create_Animation(Character, AnimationId)
local Humanoid = Character:FindFirstChildWhichIsA("Humanoid", true)
local Animation = Instance.new("Animation")
Animation.AnimationId = tostring(AnimationId)
local AnimationTrack = Humanoid:LoadAnimation(Animation)
AnimationTrack:Play()
end
local function TweenC0(Motor, EndC0)
local prop = {C0 = EndC0}
local info = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
return tweenservice:Create(Motor, info, prop):Play()
end
script.Parent.Triggered:Connect(function(player)
local Character = player.Character
local Test_Axe = script.Parent.Parent.Parent.Parent
Can_Collide(Test_Axe, false)
Create_Animation(player.Character, ("rbxassetid://7619346751"))
local Motor6D = Instance.new("Motor6D")
Motor6D.Part0 = player.Character:FindFirstChild("RightHand")
Motor6D.Part1 = Test_Axe.PrimaryPart
print(Motor6D.C0)
Motor6D.C0 = Motor6D.Part0.CFrame:inverse() * Motor6D.Part1.CFrame
Motor6D.Parent = Test_Axe.PrimaryPart
Test_Axe.Parent = player.Character
delay(1, function()
TweenC0(Motor6D, CFrame.new(0, 0, 0))
warn(Motor6D.C0)
end)
end)