I am not sure if this is the right topic
BEFORE YOU READ
My model is NOT a tool, so using most tutorials won’t work.
Hi everyone, I recently made a hammer model as a part of a challenge, and I’m currently trying to script it. My script does work, my only problem is that the hammer’s handle isn’t going where it should be.
Here’s what it should look like:
And here’s what it looks like in-game:
This is my script I used for my hammer, keep in mind that my hammer is NOT a tool, but a model that is stored in the workspace. The script goes into StarterCharacterScripts.
local swinganim = script:WaitForChild("SwingAnimation")
local swinganimtrack
local canswing = true
local Human = script.Parent:WaitForChild("Humanoid")
mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:connect(function(key)
key = key:lower()
if key == "f" and canswing then
canswing = false
print("Swung hammer")
if not swinganimtrack then swinganimtrack = Human:LoadAnimation(swinganim) end
swinganimtrack:Play()
Human.WalkSpeed = 0
Human.JumpPower = 0
local weld = Instance.new("Motor6D")
local hammer = game.Workspace.Hammer
hammer.Handle.Transparency = 0
hammer.Parts.Bands.Transparency = 0
hammer.Parts.Shaft.Transparency = 0
hammer.Parts.Top.Transparency = 0
hammer.Parts.Connector.Transparency = 0
hammer.Parent = Human.Parent
weld.Parent = Human.Parent:WaitForChild("Right Arm")
weld.Part0 = Human.Parent:WaitForChild("Right Arm")
weld.Part1 = hammer.Handle
wait(0.5)
hammer.Parent = game.Workspace
hammer.Handle.Transparency = 1
hammer.Parts.Bands.Transparency = 1
hammer.Parts.Shaft.Transparency = 1
hammer.Parts.Top.Transparency = 1
hammer.Parts.Connector.Transparency = 1
weld:Destroy()
print("Can swing again")
Human.WalkSpeed = 18
Human.JumpPower = 30
canswing = true
end
end)
I’m not sure what could be causing this issue, it might be how I welded it or animated it but I’m still not sure.
Thank you for reading and considering to help me!