Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My character position changes whenever I equip my tool?

Asked by 6 years ago

GIF Below

https://gyazo.com/3130ce334e3d77d5e1763363f3566972

This has been happening to all my tools, I've asked this question a couple times but the answer is always "Unanchor Parts" or "Change CustomPhysicalProperties Density" which hasn't worked. Help would be appreciated.

tool = script.Parent
local player = game.Players.LocalPlayer or game.Player:WaitForChild("LocalPlayer")
character = player.Character or player:WaitForChild("Character")
rhand = character:FindFirstChild("RightHand")
hum = character.Humanoid
jitte = tool.Jitte

tool.Equipped:connect(function()
    jitte.CFrame = rhand.CFrame * CFrame.new(0,0,-3.2)
    local weld = Instance.new("Weld")
    weld.Parent = tool
    weld.Part0 = jitte
    weld.C0 = jitte.CFrame:inverse()
    weld.Part1 = rhand
    weld.C1 = rhand.CFrame:inverse()
    jitte.Anchored = false
end)
0
This indicated a part in your tool is anchored. Unanchored it. MachoPiggies 526 — 6y
0
No offence, but did you even read what I wrote? There's only a single part and it is Unanchored. nicktooner 119 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Because you're setting the jitte's CFrame, then creating a weld where it's the Part0, then asking the right hand to offset that Part0.

You could assign the hand to the weld's Part0 instead, but tools have a built in weld methodology using a part named 'Handle', and a Grip property where Tool.Grip is the weld's offset; so there isn't a real requirement for you to do that in Lua.

I'm a fan of not using roblox's provisions due to limitations and in effect I don't use any Tool instances; so I would recommend just flip flopping the welds Part0 and Part1 as preferable over using the Grip property.

Ad

Answer this question