#gun system bug
185 messages · Page 1 of 1 (latest)
** You are now Level 2! **
i know
local create = require(game:GetService("ReplicatedStorage"):WaitForChild("LoadLibrary"):WaitForChild("RbxUtility")).Create
function weldObject(x, y)
local cf = CFrame.new(x.Position)
local c0 = x.CFrame:toObjectSpace(cf)
local c1 = y.CFrame:toObjectSpace(cf)
create("Weld"){
Part0 = x,
Part1 = y,
C0 = c0,
C1 = c1,
Parent = x,
}
end
function combineParts(object)
if script.Parent:FindFirstChild("Handle") then
if object:IsA("BasePart") then
weldObject(script.Parent.Handle, object)
object.Anchored = false
else
table.foreach(object:GetChildren(), function(i, c)
combineParts(c)
end)
end
else
print("Handle is nil!")
end
end
combineParts(script.Parent)
script.Disabled = true
this is
gun
script
welder
and this is webbing script
local Armor = script.Parent.Parent.Parent
Armor.PrimaryPart = Armor:WaitForChild("Torso")
local ProximityPrompt = script.Parent
--/Welds
function WeldParts(part0,part1)
local newWeld = Instance.new("Weld")
newWeld.Part0 = part0
newWeld.Part1 = part1
newWeld.C0 = CFrame.new()
newWeld.C1 = part1.CFrame:toObjectSpace(part0.CFrame)
newWeld.Parent = part0
end
--//Main Function
ProximityPrompt.Triggered:Connect(function(Player)
local Character = Player.Character
local Torso = Character:WaitForChild("Torso")
ProximityPrompt.ActionText = "Wear"
if Character:FindFirstChild(script.Parent.Parent.Parent.Name) then
Character[script.Parent.Parent.Parent.Name]:Destroy()
elseif Player:IsInGroup(34018640) then
local NewArmor = Armor:Clone()
NewArmor:SetPrimaryPartCFrame(Torso.CFrame)
NewArmor.PrimaryPart:Destroy()
ProximityPrompt.ActionText = "Take off"
for _, part in pairs (NewArmor:GetChildren()) do
if part:IsA("BasePart") then
WeldParts(Torso, part)
part.CanCollide = false
part.Anchored = false
end
end
NewArmor.Parent = Character
end
end)
i think that this two scripts are incorupting each other
Hold on-- what exactly is your problem? I thought it had to do with the glitchy UI, not the guns
watch video
and problem is with
this thing
webbing
and when i hiding gun
the webbing is in air
he looses welds
i tried yesterday repair it for like 3 hours ?
and i still dont know
with other similar but not the same gun systems
there isnt problem
help 😭
🥺
help
Just got done helping someone else who asked for help earlier, sorry for the wait. Is there any code that goes off when the gun is unequipped? Also if you get the armour, equip the gun, unequip the gun, move, then re-equip the gun, what happens to the armour?
armour stays in the same position
no problem
thats good
this code
is when equip and unequip
i mean welds
rest is gui and main script
It runs twice?
wait right
** You are now Level 3! **
fr
Once when it's equipped and once when it's unequipped
lemme check
this is in the main
script
tool.Unequipped:connect(function(mouse)
if playergui:FindFirstChild("GunGUI") then
local OLDGUI = playergui:FindFirstChild("GunGUI")
OLDGUI.GUIAnimation2.Disabled = false
OLDGUI.Name = "OldGUI"
game.Debris:AddItem(OLDGUI,5)
end
PlayerMouse.Icon = ""
welding.SetArms(false)
equipped = false
isZoomed = false
Interrupted = false
armToggle.Value = true
mouseDown = false
crouch = false
welding.Crouch(false)
reloading = false
InstazoomOutWalking()
StanceCheck()
local EndWalkSpeed = 16
if game.ServerScriptService:FindFirstChild("DefaultWalkSpeed") then
EndWalkSpeed = game.ServerScriptService:FindFirstChild("DefaultWalkSpeed").Value
end
char.Humanoid.WalkSpeed = EndWalkSpeed
player.CameraMaxZoomDistance = 400
end)
tool.Equipped:connect(function(mouse)
wait()
ResetCamZooms()
StanceCheck()
welding.SetArms(true)
equipped = true
local OldGUIs = playergui:GetChildren()
for i = 1, #OldGUIs do
if (OldGUIs[i].Name == "GunGUI") or (OldGUIs[i].Name == "OldGUI") then
OldGUIs[i].GUIAnimation2.Disabled = false
game.Debris:AddItem(OldGUIs[i],5)
end
end
local newGui = GunGUI:Clone()
newGui.GUIAnimation.Disabled = false
newGui.Main.GunName.Text = script.Parent.Name.."/"..script.Parent.GunType.Value
newGui.Parent = playergui
call.UpdateGui()
mouse.Button1Down:connect(function() bindings.MouseClick(mouse) end)
mouse.Button1Up:connect(function() bindings.MouseRelease(mouse) end)
mouse.Button2Down:connect(function() zoomIn(mouse) end)
mouse.Button2Up:connect(function() zoomOut(mouse) end)
mouse.KeyDown:connect(function(key) bindings.KeyPressed(key, mouse) end)
mouse.Move:connect(function()
if equipped and playergui:FindFirstChild("GunGUI") then
playergui:FindFirstChild("GunGUI").Hit.Position = UDim2.new(0, mouse.X-22.5, 0, mouse.Y-22.5)
end
this is too in main script
What's the weilding object?
i think so
welding.SetArms(false) <-- this is a method of the primary part?
welding is this thing that
u know
welds
set arms
i think it will be like where it is welding
bro what's the code for it-- that's what I'm getting at
Is it being required from somewhere? It looks like it's calling a function somewhere, not assingning a variable
here is 2405 code lines so
im doing that bro
im not in roblox studio from yesterday
but when i
searching serarms i getting only this
function welding.SetArms(bool)
if settings.animationtype == "Weld" then
event:FireServer({["Function"] = "Weld", ["RightPos"] = RightPos, ["LeftPos"] = LeftPos, ["Bool"] = bool, ["HasFakeArm"] = settings.HasFakeArm})
elseif settings.animationtype == "Animations" and settings.animationsfolder ~= nil then
local default = settings.animationsfolder:FindFirstChild("Default")
local reload = settings.animationsfolder:FindFirstChild("Reload")
local crouch = settings.animationsfolder:FindFirstChild("Crouch")
local sprint = settings.animationsfolder:FindFirstChild("Sprint")
if default and reload and crouch and sprint and bool then
defaultanimation = char.Humanoid:LoadAnimation(default)
reloadanimation = char.Humanoid:LoadAnimation(reload)
crouchanimation = char.Humanoid:LoadAnimation(crouch)
sprintanimation = char.Humanoid:LoadAnimation(sprint)
defaultanimation:Play()
local con
con = defaultanimation.KeyframeReached:connect(function(keyframeName)
con:disconnect()
if keyframeName == "Finish" then
defaultanimation:AdjustSpeed(0)
end
end)
end
else
defaultanimation:Stop()
reloadanimation:Stop()
crouchanimation:Stop()
sprintanimation:Stop()
end
end
and the equip and unequip
thing
this is wolfenchan
i dont know if u are in pvp games
but for informations
wolfenchan gun system
i mean this script is only for one weapon btw
i really dont know how to repair it like
im already stupid abt that xd
i got tweenjoint if its telling u something
function TweenJoint(Joint, newC0, newC1, Alpha, Duration)
event:FireServer({
["Function"] = "Tween",
["Client"] = game.Players.LocalPlayer,
["Joint"] = Joint,
["C0"] = newC0,
["C1"] = newC1,
["Alpha"] = Alpha,
["Duration"] = Duration
})
spawn(function()
local newCode = math.random(-1e9, 1e9) --This creates a random code between -1000000000 and 1000000000
local tweenIndicator = nil
if (not Joint:findFirstChild("tweenCode")) then --If the joint isn't being tweened, then
tweenIndicator = Instance.new("IntValue")
tweenIndicator.Name = "tweenCode"
tweenIndicator.Value = newCode
tweenIndicator.Parent = Joint
else
tweenIndicator = Joint.tweenCode
tweenIndicator.Value = newCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
end
--local tweenIndicator = createTweenIndicator:InvokeServer(Joint, newCode)
if Duration <= 0 then --If the duration is less than or equal to 0 then there's no need for a tweening loop
if newC0 then Joint.C0 = newC0 end
if newC1 then Joint.C1 = newC1 end
```
else
local Increment = 1.5 / Duration
local startC0 = Joint.C0
local startC1 = Joint.C1
local X = 0
while true do
game:GetService("RunService").RenderStepped:wait() --This makes the for loop step every 1/60th of a second
local newX = X + Increment
X = (newX > 90 and 90 or newX)
if tweenIndicator.Value ~= newCode then break end --This makes sure that another tween wasn't called on the same joint
if (not equipped) then break end --This stops the tween if the tool is deselected
if newC0 then Joint.C0 = startC0:lerp(newC0, Alpha(X)) end
if newC1 then Joint.C1 = startC1:lerp(newC1, Alpha(X)) end
--if newC0 then lerpCF:InvokeServer(Joint, "C0", startC0, newC0, Alpha(X)) end
--if newC1 then lerpCF:InvokeServer(Joint, "C1", startC1, newC1, Alpha(X)) end
if X == 90 then break end
end
end
if tweenIndicator.Value == newCode then --If this tween functions was the last one called on a joint then it will remove the code
tweenIndicator:Destroy()
end
--deleteTweenIndicator:InvokeServer(tweenIndicator, newCode)
end)
end

This rabbit hole goes deep... in the setArms thing, it fires some weilding event to the server. Do you know what scriot that goes to? Tbh it could have something to do with animations, but i don't think animations would replace/unweild a character's torso
This part in SetArms:
event:FireServer({["Function"] = "Weld", ["RightPos"] = RightPos, ["LeftPos"] = LeftPos, ["Bool"] = bool, ["HasFakeArm"] = settings.HasFakeArm})
Also "Bool" is a terrible name for a variable...
I'm ready to jump off a cliff before I read 932 lines of code 💀
fr
** You are now Level 4! **
Not only that, the names of these variables are atrocious
"Event", "Event2", "remote"
LIKE HOW AM I SUPPOSED TO KNOW WHAT THE HECK THEY DO
every event is in main script
right now i think u are better than me cuz u are smarter
then me
i hope XD
Every event has a different function, but there's no way to intuit what they do without spending hours deep diving into the code
I know where they are, but I don't know what they do
is this script which got 2400 lines
Take a crack at it-- what do you think the difference between event and event2 is?
have you created these scripts yourself?
mmm can tell its not created by you
Cuz no one creates events with scripts unless they know that the script is going to be used in another game
i dont know what i suppose to do now
So this one was made by wolf
And this one by you?
yes
seems like it
If that's the case, then something immediatly jumps out to me
They weild differently
Wolf uses some kind of library that I've never heard of, and you manually weild it
Try refactoring your code to use the same weild as wolf
Maybe the library has some kind of protections for this?
know anything abt script of wolf
maybe
I can't exactly tell you how to use it since I've never heard of this before
so good luck lol
I could tell at first glance those 2 scripts are written by 2 different people
the complexity difference is like >>>>>>>>>>>>>>>>
if the problem happens after unequipping just make it so that when the tool is unequipped and the player has a vest then it gets welded again after unequipped, it won't like FIX your problem but its a temporary tape for the incoming flood
thanks bro <3
the third one
its like a scripter 3 type script, I dont get a word
i wanted to do exactly likeu sayin
fr
i think i will just change gun system
cuz i will take longer to fix this then just change it and have some butt pain abt worse gun system
I mean, if the original person who made the gun system has their contact info, maybe you could ask them?
i though abt that
but wolfenchan is no longer updating
soo idk
check this out lolz
** You are now Level 5! **
lore