wait(5)
local Player = game.Players.LocalPlayer
local AllKnownWeapons = {"Radistal"}
local Debounce = 15
local ReplicateGunMovementEvent = game.ReplicatedStorage.ReplicateGunMovement
game:GetService("RunService").RenderStepped:Connect(function()
    local WeaponType = "None"
    local AllPosessions = Player.Character:GetChildren()
    local Handle = nil
    for Item = 1, #AllPosessions do
        for WeaponName = 1, #AllKnownWeapons do
            if AllPosessions[Item].Name == AllKnownWeapons[WeaponName] then
                WeaponType = AllPosessions[Item].WeaponType.Value
                Handle = AllPosessions[Item].Handle
                local TouchInterest = Handle:FindFirstChild("TouchInterest")
                if TouchInterest then
                    TouchInterest:Destroy()
                end
            end
        end
    end
    if WeaponType == "None" then
        --No Tool Equipped
    elseif WeaponType == "OneHanded" then
        local Grip = Player.Character.RightHand:FindFirstChild("RightGrip")
        if Grip then
            Grip:Destroy()
        end
        local Mouse = Player:GetMouse()
        Mouse.TargetFilter = Player.Character
        if Mouse.Hit ~= nil and Mouse.Hit.Y ~= 0 and Mouse.Hit.Y ~= nil then
            Handle.CFrame = CFrame.new(Player.Character.RightHand.Position, Vector3.new(Mouse.Hit.X, Mouse.Hit.Y, Mouse.Hit.Z))
            if Debounce == 0 then
                ReplicateGunMovementEvent:FireServer(Handle, Handle.CFrame)
                Debounce = 15
            else
                Debounce = Debounce - 1
            end
        end
    end
end)

For some reason this local script is causing my weapon to be randomly deleted between roughly 40 and 55 seconds after being equipped, but the script itself works perfectly for those 40-55 seconds.

Additional Info:

  • I know this script is causing the tool to be deleted because it only happens when this is enabled.
  • This is a local script, the only thing that it does when firing the server is making the tool's rotation match on the server so that everyone else can see it so I did not include that script.
  • It leaves no errors.
  • I have not used any free models so no this is not a virus.

Any help would be greatly appreciated, I have been at this since yesterday with still no solution.

6 comments

0

This might be because of destroying the grip, or touch interest. Try removing those lines of code.

0

if i remove the grip destroying code then this no longer happens but the issues is it is 100% necesarry to have that code as if I dont then the player will fly into the air when the tool is equipped cuz physics

0

also the intersting thing is the code that destroys the grip runs 40-55 seconds before the tool even gets destroyed

0

maybe turn on mass less for each part / base part in your tool?

0

its not about mass. Its being instantly destroyed

0

plus that isnt how massless works