Hello! I have been making a FPS framework and I have encountered this problem. If I use Stepped, Heartbeat or a while loop for my Server Handler, the gun seems to lag behind while the player is moving. RenderStepped works fine but it can only be used in local scripts. How can I fix this? Here's my code:
local RS = game:GetService("ReplicatedStorage")
local Run= game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local Tservice = game:GetService("TweenService")
local players = game:GetService("Players")
local MainCframe = CFrame.new(0.8,1,-0.7)
local function Equip(cam, primary)
for i, player in pairs(players:GetPlayers()) do
local GunClone = RS:WaitForChild("GunModels").Server.M4A1:Clone()
local character = player.Character or player.CharacterAdded:Wait()
character["Left Arm"].Transparency = 1
character["Right Arm"].Transparency = 1
GunClone.Parent = character
Run.Heartbeat:Connect(function()
GunClone:SetPrimaryPartCFrame(character.Torso.CFrame * MainCframe)
end)
end
end
RS:WaitForChild("Events").Equip.OnServerEvent:Connect(Equip)
It is not finished though.
Thing's I tried:
Searching online - I did not find anything helpful, Trying to use Bind to render stepped - I failed because I have no idea to use it.

1 comment
Thanks! I understand now.