Why isn't this working?

Yes, make sure the tool parts you are using are inside a model AND set the model’s “PrimaryPart” property to a part that remains static/not animated, but is attached to the rest of the parts (like with Motor6Ds)

I don’t really understand. Sorry, all of this is sort of new to me.

It’s okay, send a screenshot of the tool model and everything in it

1 Like


There is useless stuff below it.

This is trial and error, but try setting the model’s PrimaryPart to the “Top” part (click the model, look for where it says “PrimaryPart”)

After that, try testing the script again

Now it does this:

That’s a start! Okay, now what is the proper holding animation?

This (Ik it doesn’t look the best)
image

Wait, are the animations just for the player (like holding, reloading, etc)?

Or are there a mix of animations for the player and the gun? Like, does the gun itself have any moving parts that animate?

1 Like

They are animations. For holding, reloading, firing etc

Okay, yes, but I am asking, does the gun itself have anything that animates? Pretend there is no player, if there is no player, does the gun have any animations that do anything?

No, I think they all have character movements, is that what you mean? This is example:
robloxapp-20220204-2323479.wmv (857.0 KB)

Yes! That makes things significantly easier then. Hold up, writing proper code now

1 Like

Try this localscript. (Disable the other two):

local Player = game:GetService("Players").LocalPlayer
local CharacterAdded = Player.Character or Player.CharacterAdded:Wait()
local Character = Player.Character

--Get the tool and then get the model of your tool you are using.
--If you do not have your tool part(s) wrapped in a model, it's a good idea to do so. Make sure to set the Model.PrimaryPart to a part that stays static and has no animations on it
local tool = script.Parent
local yourToolModel = tool["YourToolModelGoesHere"]

--Create a handle (make sure to have UseHandle checked on the tool)
local handle = Instance.new("Part")
handle.Name = "Handle"
handle.Transparency = 1
handle.CanCollide = false
handle.Size = Vector3.new(0.1,0.1,0.1)
handle.Parent = tool


--Line up the model with the handle
yourToolModel:SetPrimaryPartCFrame(handle.CFrame)

--Makes the tool model attach to the handle with a WeldConstraint
local newWeld = Instance.new("WeldConstraint")
newWeld.Part0 = handle
newWeld.Part1 = yourToolModel.PrimaryPart
newWeld.Parent = handle

UIS.InputBegan:Connect(function(Input, GP)
	if Input.KeyCode == Enum.KeyCode.R and not GP then
		print("starting")
		local humanoid = Character:FindFirstChildOfClass("Humanoid")
		if humanoid then
			local Animation = Instance.new("Animation", humanoid)
			Animation.AnimationId = "rbxassetid://8725074606"
			local animator = humanoid:FindFirstChildOfClass("Animator")
			if animator then
				local animationTrack = animator:LoadAnimation(humanoid.Animation)
				animationTrack:Play()
				return animationTrack
			end
		end
	end
end)

It’s just a test for now, to see how things will work

It’s a bit inverted? Not sure what to call it.
robloxapp-20220204-2330369.wmv (927.3 KB)

That’s progress!

Try messing with the tool’s
GripRight and GripUp properties until we get closer to the desired result

1 Like

Can’t really find which property changed orientation?

Pro tip: you should be able to add this line of code to the localscript (after it creates the handle) to make it easier to rotate the grip:

--Rotate grip!
tool.Grip = CFrame.new(tool.Grip.Position) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))

You can change the orientation by changing the zeros in the math.rads

1 Like

Now it does this:
robloxapp-20220204-2351183.wmv (435.1 KB)

Getting the right tools grip is largely trial and error, so it may take a few attempts to get right.

Try replacing the zeros as follows:
90 0 0