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

How do I fix a welded model's orientation changing every time I call a function?

Asked by 4 years ago

I know what the problem is, I just don't know the solution and I've been looking for like an hour or so, so I figured since I've tried so much and can't find the solution it'd be better to ask directly for it.

What I'm trying to do is weld a shovel to the character's right hand, I have a shoveling animation all set up and the shovel is welded to the right hand. The issue is that the orientation changes every time.

I believe it's because of the player's idle animation moving the hand's orientation slightly making the shovel's orientation move too. Here's the code, tell me if there's an important piece of information missing, but I don't think there is.

(Also, the CFrame stuff is just things I tried, CFrames confuse me and it didn't work)

01local pps = game:GetService("ProximityPromptService")
02local pp = script.Parent.ProximityPrompt
03local Shovel = game.Workspace.Tools.Shovel
04 
05pps.PromptTriggered:Connect(function(pp, plr)
06    local character = plr.Character
07    local humanoid = character.Humanoid
08    local grass = script.Parent
09    local track = humanoid:LoadAnimation(script.Parent.Dig)
10    local newShovel = Shovel:Clone()
11    local ShovelWeld = Instance.new("WeldConstraint")
12    newShovel.Name = "NewShovel"
13    newShovel.Handle.Position = character.RightHand.Position
14    newShovel.Parent = character
15    newShovel.Handle.CFrame = CFrame.new(newShovel.Handle.Position) * CFrame.fromEulerAnglesXYZ(math.rad(0 + character.RightHand.Orientation.x), math.rad(90 + character.RightHand.Orientation.y), math.rad(-180 + character.RightHand.Orientation.z))
View all 24 lines...

Thank you so much if you know the solution!!!

0
you should try using r6, this may not help but the animations are way less movements than r15 Xapelize 2658 — 4y
0
The problem with this is the digging animation is R15 and it looks really bad in R6. Hqsuperlabgames 41 — 4y

Answer this question