Im trying to make a gun system it’s great and all, but has one “tiny” problem.
After a while, the gun slows down. Even if i don’t use the gun it still slows it down.
I tried the following methods:
Tried to disable scripts to see which can cause it (even if i disabled all scripts its still slow after a while)
Tried to delete specific lines from the script like the animations, the loops, the “waits” and others
Tried to only run the local script of the gun making it able to shoot but unable to damage
Tried to move the Instances from outside the tool to workspace to prevent lag
Tried to move the scripts to the gun GUI
Hello. Yes it is. Ill quickly make it local sided. I still want to make the tracers be local sided so i’ll script it that way. I’ll let u know if it worked or not
may I see your render script?
the server should tell every client the origin and direction of the ray. The client will then cast a ray and determine if it is a hit to find the destination
i sent everything in the post you can review it if you’d like. Tose two are the only scripts i use the others are just particle effects and equipped functions
See , the problem is that the bullet tracer is created server side . To prevent it from lagging , you can fire a remote event called render bullet to all plr . When the player receive the message , the plr will create a tracer client side from origin to destination
The problem was a local script that sets the imagelabel to the cursor so it creates a crosshair.
the issue:
local RunService = game:GetService(“RunService”)
local mouse = game.Players.LocalPlayer:GetMouse()
RunService.Heartbeat:Connect(function(step)
while wait(0.1) do
script.Parent.Position = UDim2.new(0, mouse.X, 0, mouse.Y) + UDim2.new(0, -12, 0, -12)
end
end)
removing this solved my problem. Thank you for everyone for their time posting here!