#Raycast Problems
1 messages · Page 1 of 1 (latest)
Error:
ServerScriptService.ServerSuspension:55: attempt to perform arithmetic (sub) on nil and number
suspensionLengthMemory[wheel.Name]
check if this is nil
K
It doesn’t print nil
It prints the wheel name and is equal to .5
ill check
delta dosent equal nil either
then i assume springlength is nil
so how do i fix it then
don't use rayOrigin.p use rayOrigin.Position instead
either rayOrigin is nil or hitPosition is nil
there's a cool thing with raycasts you can do
local RaycastResult = workspace:Raycast(Origin,Direction,RaycastParams) or {Position = Origin+Direction}
so now Position can't be nil
K
Where would it go it in the script
So something like this
workspace:Raycast(rayOrigin.Position -rayDirection, rayParams)?
K, now line 58 has an error
Sam thing
is this your own script or what?
it is i was comfused lol
but i get the same error on a different line now
local springLength = (rayOrigin.Position - hitPosition).Magnitude - WHEEL_RADIUS
it just means something is nil
something doesnt exist
hitPosition is probably nil
local raycastResult = workspace:Raycast(rayOrigin.Position, -rayDirection, rayParams) or {Position = rayOrigin.Position-rayDirection}
paste this into line 47
still nil?
yes
maybe rayOrigin.Position is nil?
it might be
its not nil. i printed it