Hello, I’ve been recently making a shooter game with serversided projectiles. The problem was when I wanted to make fast projectiles, which .Touched could not handle, so I thought about using raycast between previous and current positions to check skipped frames.
The issue with this is that it most of the time won’t work, it’s too inconsistent! Sometimes it does (the output says it) but sometimes not.
I have tried using .Changed, :GetPropertyChangedSignal() and loops on the checks, but none seemed to work.
I also have tried adding a delay which did not solve the issue. Any help is appreciated!
Part:GetPropertyChangedSignal("Position"):Connect(function()
if Touched == false then
Check()
end
Pos = Part.Position
end)
local function Check()
local RaycastParam = RaycastParams.new()
RaycastParam.FilterDescendantsInstances = IgnoreStuff
local StartingPosition = Pos
local Mag = (Pos - Part.Position).magnitude
local StartingPosition2 = Part.Position
local Raycast = workspace:Raycast(StartingPosition,(StartingPosition2 - StartingPosition) * 100,RaycastParam)
if Raycast and Raycast.Instance:IsA("BasePart") and Raycast.Instance.Name ~= "Ignore" and not Raycast.Instance:FindFirstChild("Ignore") or Raycast and Raycast.Instance:IsA("Part") and Raycast.Instance.Name ~= "Ignore" and not Raycast.Instance:FindFirstChild("Ignore") then
print("RaycastFound")
Touched = true
Tween:Cancel()
Explode(Raycast.Instance,CFrame.new(Raycast.Position))
end
end