Im guessing they just shoot a ray cast from the players camera each time the cameras CFrame updates?
Also how do you know if it’s on the server? There will always be latency between the client and server, there is just no avoiding that (unless with something very advanced), I don’t see a point in making it on the server, its just slower and from what I can see, will only be a visual thing, not a main game mechanic. So making it on the server is just unnecessary, I would love to hear your view though.
But anyways, since this is a visual thing, I guess make 2 separate objects, make one that’s smooth that only works on the client, and a second one that is invisible and works on the server, so you get the smoothness from the client and the replication on the server.
I guess do this approach, but replicate the invisible dot to other players, because in arsenal, its so fast paced, the latency from the servers dot will probably barely be noticed by the player/players.
The problem is getting the client object to be smooth, though. Thats the whole reason I made this post - I tried using RenderStepped and it gave me that choppiness that you see in the video.
I also don’t see the point of RayCasting if Mouse.Hit works just as well, but maybe you know something I don’t.
Taken from the ROBLOX Mouse documentary and edited.
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local attachment0 = Instance.new("Attachment")
local attachment1 = game.ReplicatedStorage.GreenDot.Attachment:Clone()
beam.Attachment0 = attachment0
beam.Attachment1 = attachment1
attachment0.Parent = workspace.Terrain
attachment1.Parent = workspace.Terrain
local function onRenderStep()
local character = player.Character
if not character then
return
end
local head = character:FindFirstChild("Head")
if not head then
return
end
local origin = head.Position
local finish = mouse.Hit.Position
attachment0.Position = origin
attachment1.Position = finish
end
RunService.RenderStepped:Connect(onRenderStep)