#gun system bug

185 messages · Page 1 of 1 (latest)

lucid saffron
proven sphinxBOT
#

studio** You are now Level 2! **studio

lucid saffron
#

🥺

#

🙏🏻

#

help

brisk acorn
lucid saffron
#

soo

#

i will give 2 scripts

#

gun system thing

#

and webbing

brisk acorn
#

Ok, just be sure to use this:

lucid saffron
#

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

brisk acorn
#

Hold on-- what exactly is your problem? I thought it had to do with the glitchy UI, not the guns

lucid saffron
#

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

brisk acorn
#

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?

lucid saffron
lucid saffron
#

is when equip and unequip

#

i mean welds

#

rest is gui and main script

brisk acorn
lucid saffron
#

wait right

proven sphinxBOT
#

studio** You are now Level 3! **studio

lucid saffron
#

fr

brisk acorn
#

Once when it's equipped and once when it's unequipped

lucid saffron
#

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

brisk acorn
#

What's the weilding object?

lucid saffron
#

primary part

#

of the model

#

which is welding to the player

#

humanoid

lucid saffron
brisk acorn
#

welding.SetArms(false) <-- this is a method of the primary part?

lucid saffron
#

welding is this thing that

#

u know

#

welds

#

set arms

#

i think it will be like where it is welding

brisk acorn
#

bro what's the code for it-- that's what I'm getting at

lucid saffron
#

lemme copy it

brisk acorn
#

Is it being required from somewhere? It looks like it's calling a function somewhere, not assingning a variable

lucid saffron
#

here is 2405 code lines so

brisk acorn
#

Ctrl + F for SetArms

#

But wow is that big

lucid saffron
#

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

lucid saffron
#

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
brisk acorn
#

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

lucid saffron
#

u mean

#

main server?

brisk acorn
#

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...

lucid saffron
#

fire server is to start event

#

event

#

is idk what

#

fire server

brisk acorn
#

Yeah, but what script receives the event?

#

oh

lucid saffron
#

it will bi in main srcipt

#

then

#

here is

#

main script

brisk acorn
#

I'm ready to jump off a cliff before I read 932 lines of code 💀

lucid saffron
#

fr

proven sphinxBOT
#

studio** You are now Level 4! **studio

lucid saffron
#

same

#

but i need to fix it cuz we need webbings and gun system

brisk acorn
#

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

lucid saffron
#

every event is in main script

lucid saffron
#

then me

#

i hope XD

brisk acorn
#

Every event has a different function, but there's no way to intuit what they do without spending hours deep diving into the code

lucid saffron
#

i sarched some internet

#

and

#

there is nothin abt that

#

i will try more maybe

lucid saffron
#

client connection

brisk acorn
#

I know where they are, but I don't know what they do

lucid saffron
#

is this script which got 2400 lines

brisk acorn
#

Take a crack at it-- what do you think the difference between event and event2 is?

lucid saffron
#

raycreation is for settings in weapon

#

and client is for client

#

maybe ?

modest spruce
#

have you created these scripts yourself?

lucid saffron
#

nope

#

thats

#

wolfenchan gun system

#

webbing system i created

modest spruce
#

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

lucid saffron
#

i dont know what i suppose to do now

lucid saffron
#

yes

modest spruce
#

seems like it

brisk acorn
#

If that's the case, then something immediatly jumps out to me

#

They weild differently

lucid saffron
#

cuz

#

webbing is on torso

#

gun is on hand

brisk acorn
#

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

lucid saffron
#

maybe yes

#

but i dont

brisk acorn
#

Maybe the library has some kind of protections for this?

lucid saffron
#

know anything abt script of wolf

brisk acorn
#

I can't exactly tell you how to use it since I've never heard of this before

#

so good luck lol

modest spruce
#

I could tell at first glance those 2 scripts are written by 2 different people

#

the complexity difference is like >>>>>>>>>>>>>>>>

lucid saffron
#

which is better ?

#

XD

modest spruce
#

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

lucid saffron
modest spruce
brisk acorn
#

God knows what wolf did

modest spruce
#

its like a scripter 3 type script, I dont get a word

lucid saffron
lucid saffron
#

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

brisk acorn
#

I mean, if the original person who made the gun system has their contact info, maybe you could ask them?

lucid saffron
#

i though abt that

#

but wolfenchan is no longer updating

#

soo idk

#

check this out lolz

proven sphinxBOT
#

studio** You are now Level 5! **studio

lucid saffron
#

lore

#
WOLFENCHAN Wiki

Early in the 1930s, roughly 1932, Wolfenchan is born in the flames of the rise of the national socialist ideology in Germany. Formed by mainly capitalist and questionables, the company is not...