Hello! I’m trying to make a grappling hook, this grappling hook tweens the player to the mouse but it only moves the humanoidrootpart and not the whole character itself. It’s like the character is not welded or rigged together even though it uses the users choice of avatar
This means you are tweening the humanoidRootPart .Position. You will need to tween the entire .CFrame to do it.
local goalPosition : Vector3 -- input goal position here
local currentCF = humanoidRootPart.CFrame
local goalCF = currentCF -currentCF.Position + goalPosition-- maintain current orientation, removing the position component and replacing it with the new goal component
where would i put this in this script?
--UIS.InputBegan:Connect(function(input,gameprocessed)
if gameprocessed then return end
if input.KeyCode == Enum.KeyCode.Q then
local endbeam = game.ReplicatedStorage.Items.BeamEnd:Clone()
endbeam.Parent = game.Workspace
endbeam.Position = mouse.hit.p
local beam = game.ReplicatedStorage.Items.ChainBeam:Clone()
beam.Parent = endbeam
beam.Attachment0 = endbeam.Attachment
beam.Attachment1 = char.RightHand.RightGripAttachment
local tweening = TweenService:Create(char.PrimaryPart, Info, goal)
for i,v in pairs(char:GetChildren()) do
if v:IsA("Part") then
v.Anchored = true
end
end
tweening:play()
end
end)
you need to replace the goal table.
local goalPosition : Vector3 =mouse.hit.p -- input goal position here
local currentCF = humanoidRootPart.CFrame
local goalCF = currentCF -currentCF.Position + goalPosition
local goal = {
CFrame = goalCF
}
Thanks this works but this is a issue on my part where the character gets teleported to a random area and not the mouse but thanks for helping me