I'm making a gun with raycasting and there's a delay when I fire the remote event. How do I fix this?
COMMUNITY QUESTION
How to raycast without a delay?
1 answer
i hope your not exaggerating. But if its really that slow, paste this code in a local script and make sure the local script is somewhere like starter player scripts
local runService = game:GetService("RunService")
local frameCount = 0
local function update()
frameCount += 1
end
runService.RenderStepped:Connect(update)
local fps = 0 -- Updates every second
while wait(1) do
fps = frameCount
frameCount = 0
print(fps)
end
if you make it a server scritps, it tells you tps which isnt that much different but still fps is more useful so make it local script because that way you can spot more problems. Maybe u have potato computer? or maybe you live far away from roblox hardware servers? or maybe theres so many parts in ur game that its lagging the game a lot like that.
2 comments
0
The delay isn't that bad it's only terrible when my character is moving.
0
that means something, do you have any scripts that detect movement?
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Latency is expected, but on a scale that would cause concern, it is possibly your program's logic. Could you paste your code here?
No, my code is fine. I just need a trick to get rid of that delay.