I've been working on a cframe bullet drop script, where it creates a ray every so often based on raysPerSecond and metersPerSecond (basically studs per second.) The issue is that when i increase the raysPerSecond, the "bullet" drops a lot faster than a lower raysPerSecond. When the raysPerSecond is set to 6, it gives me roughly the right travel time to bullet drop, but when I increase it, it drops a lot more compared to its travel time. Here's the script:
local plr = game.Players.LocalPlayer; local char = plr.Character; local m = plr:GetMouse() local metersPerSecond = 500; local raysPerSecond = 30; local dropPerSecond = Vector3.new(0, -30, 0) local maximumDistance = 1000; function fire() local metersPerRay = metersPerSecond/raysPerSecond; local raysGenerated = 0; local function generateRay(startPosition, direction) raysGenerated = raysGenerated + 1; local bulletPath = Ray.new(startPosition, direction*metersPerRay) local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(bulletPath, {char}) if hit ~= nil then else wait(1/raysPerSecond) if raysGenerated < maximumDistance/(metersPerSecond/raysPerSecond) then generateRay(position, ((position-startPosition)+(dropPerSecond/(raysPerSecond))).unit) end end end generateRay(char.Head.CFrame.p, (m.Hit.p-char.Head.CFrame.p).unit) end m.Button1Down:connect(function() fire() end)
I tested your code by creating a new part at the end of every ray. I didn't notice any change in changing raysPerSecond to a constant until I tested changing it in metersPerRay. To fix this, you can just change raysPerSecond in line 12 to a constant.
The problem this leads to is found in line 16:
local bulletPath = Ray.new(startPosition, direction*metersPerRay)
The bulletPath will be shorter if you increase raysPerSecond, which in turn causes the bullets to fall faster because generateRay is called more often before finding a part.