I want to make my minigun weld to my characters right arm. The reason I am doing it this way is because, I don’t want the default hold animation.
Unfortunately, the welder module I’m using is broken, but for some reason it works on other tools though theres nothing wrong with the code.
I tried making it a mainmodule so I could get it by ID, but that didn’t work either.
Server
local serverStorage = game:GetService("ServerStorage")
local modules = serverStorage:WaitForChild("Modules")
local mhb = require(modules:WaitForChild("HitBox"))
local equip = script.Parent:WaitForChild("Equip")
local welder = require(modules:WaitForChild("Welder"))
equip.OnServerEvent:Connect(function(player,bool)
local character = player.Character or player.CharacterAdded:Wait()
if bool == true then
local minigun = script.Parent.Parent:WaitForChild("MiniGun"):Clone()
minigun.Parent = character
local handle = minigun:WaitForChild("Handle")
welder(
character,
"Right Arm",
handle
)
end
end)
Client
local anims = script.Parent:WaitForChild("Anims")
local remotes = script.Parent:WaitForChild("Remotes")
local equip = remotes:WaitForChild("Equip")
script.Parent.Equipped:Connect(function()
equip:FireServer(true)
end)
Module
local players = game:GetService("Players")
return(function(x,y,z)
if x:IsA("Player") then
local character = x.Character or x.CharacterAdded:Wait()
local zWeld = Instance.new("Motor6D",z)
zWeld.Name = "weaponWeld"
zWeld.Part0 = z
zWeld.Part1 = character:WaitForChild(y)
end
end)