I have a gun that is Multi Parted and it's welds work but when I join in Roblox My gun falls out of my hand like 1 sec after I equipped it. I don't know if it's the gun or my scripts? Here are my scripts inside it. Weld Script:

tool = script.Parent
while not tool:FindFirstChild("WeldProfile") do wait() end
profile = tool.WeldProfile
function reweld()
	for k, v in pairs(profile:GetChildren()) do
		local b = v.Value
		b:BreakJoints()
		local w = Instance.new("ManualWeld")
		w.Name = "HandleWeld"
		w.Part0 = b
		w.Part1 = profile.Value
		w.C0 = v.C0.Value
		w.C1 = v.C1.Value
		w.Parent = game.JointsService
	end
end
tool.AncestryChanged:connect(reweld)
reweld()

Extra Weld script if other fails

tool = script.Parent
while not tool:FindFirstChild("WeldProfile") do wait() end
profile = tool.WeldProfile
function reweld()
	for k, v in pairs(profile:GetChildren()) do
		local b = v.Value
		b:BreakJoints()
		local w = Instance.new("ManualWeld")
		w.Name = "HandleWeld"
		w.Part0 = b
		w.Part1 = profile.Value
		w.C0 = v.C0.Value
		w.C1 = v.C1.Value
		w.Parent = game.JointsService
	end
end
tool.AncestryChanged:connect(reweld)
reweld()

Gun Script:

--Vairiables 
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Ammo = 150
local CurrentAmmo = 100
local Damage = 25
local WaitTime = .5
local Tool = script.Parent
local GunSpot = Tool.GunHole
local Character = Player.Character
local Arm = Character["Right Arm"]
--Shoot function--
function Shoot()
	if CurrentAmmo >= 1 then
		CurrentAmmo = CurrentAmmo - 1
		local Ball = Instance.new("Part",workspace)
		local dmg = Instance.new("NumberValue",Ball)
		local plr = Instance.new("StringValue",Ball)
		plr.Name = "Player"
		plr.Value = Player.Name
		dmg.Name = "Damage"
		dmg.Value = Damage
		Ball.Shape = "Ball"
		Ball.BrickColor = BrickColor.new("New Yeller")
		Ball.Material = Enum.Material.Neon
		Ball.CanCollide = true
		Ball.Size = Vector3.new(0.1,0.1,0.1)
		Ball.CFrame = GunSpot.CFrame
		Ball.CFrame = CFrame.new(Ball.Position, Mouse.Hit.p)
		local V = Instance.new("BodyVelocity",Ball)
		V.velocity = Ball.CFrame.lookVector * 90
		V.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
		script.FireSound:Play()
		local gunscript = game.Lighting.Scripts.GunDamageScript:Clone()
		gunscript.Parent = Ball
		gunscript.Disabled = false
		game.Debris:AddItem(Ball,2)
	end
end
Tool.Activated:connect(Shoot)



2 comments

0

Is there a part in the tool named Handle?

0

Yes