Function in module doesnt executing from LocalScript of Tool but in command line works

I wanna make a custom gun system for my place but function in ModuleScript doesnt executing but module works perfectly, require a module is works but function isnt working.I’m trying use command line and function works!
How is that working?
LocalScript of Tool:

local gunModule = require(game.ReplicatedStorage.modules.GunModule)
local hasVm = false
local vm = nil

game:GetService("RunService").RenderStepped:Connect(function(dlt)
	if hasVm then
		vm:FindFirstChild("CameraBone").CFrame = workspace.CurrentCamera.CFrame * CFrame.new(0.8,-0.6,-0.5)-- * CFrame.Angles(0,math.rad(90),0)
	end
end)

script.Parent.Equipped:Connect(function()
	vm, hasVm = gunModule.changeViewmodel(game.ReplicatedStorage.vms.ak12)
end)

script.Parent.Unequipped:Connect(function()
	vm, hasVm = gunModule.changeViewmodel()
end)

ModuleScript:

local module = {}

function module.changeViewmodel(vm:Model):(Model,boolean)
	
	local hasViewmodel = false
	
	if workspace.CurrentCamera:FindFirstChild("vm") ~= nil then hasViewmodel = true else hasViewmodel = false end
	
	if hasViewmodel then
		workspace.CurrentCamera:FindFirstChild("vm"):Remove()
		hasViewmodel = false
	end
	
	if vm ~= nil then
		local clone = vm:Clone()
		clone.Name = "vm"

		clone.Parent = workspace.CurrentCamera
		
		hasViewmodel = true
		
		return clone,hasViewmodel
	end
	return nil,hasViewmodel
end

return module

Please help, im really dont know how this works?
(EDIT: no error in console btw)

1h passed, no replies
maybe im lonely
(2h passed)

this code is SO BAD, ABYSMALLY HORRIBLE but this is not code review so no

Can you show us a video? This seems extremely weird.

please help, this is really need to solve
maybe @SMBri can help me?

I would try to help but uh idk what to say because im not the best scripter
Also why did you @ me

i know my code is spaghetti
here is video:

because i know you, and you helped me in this topic

rude complaints version
  • not spaghetti, its ashes :broken_heart:
  • may we not place breakpoints AROUND where it’d be the most helpful??? place it INSIDE the equipped and unequipped events, NOT around them

I doubt the Equipped and Unequipped events are even firing. Could you place a breakpoint inside those blocks?

i noticed this,this events are dont even firing (maybe), because no methods are working in these events

(EDIT: REALLY dont work)

Hey, @ryanzhzh, are you here or dead?

i solved this problem
in my tool no handle but Tool.RequiresHandle isnt firing Equipped events if no handle