As you can see, there is a ufo, and it is constantly twitching and jumping up and down. Is there a way to detect this with server scripts? The ufo is constantly being oriented upright to act as a gyro, and I think that’s the issue. But when I detect if its going fast, it doesn’t give the desired results. (its being oriented on heartbeat) This is seriously annoying, and ruins the gameplay. it sometimes jitters via turning as well, so that would be nice to detect.
This is the code I use to orient the ufo. Its quite simple
Model = script.Parent.Parent.Parent --the ufo <
game:GetService('RunService').Heartbeat:Connect(function()
local AngleZ = -Model.PrimaryPart.Orientation.Z
local AngleX = -Model.PrimaryPart.Orientation.X
Model:PivotTo(Model:GetPivot() * CFrame.Angles(math.rad(AngleX), 0, math.rad(AngleZ)))
end)
--the hover script \/, if it helps
ame:GetService('RunService').Heartbeat:Connect(function()
script.Parent.CanCollide = true
local Parts = game.Workspace:GetPartsInPart(script.Parent)
script.Parent.CanCollide = false
if isEmpty(Parts) then
script.Parent.AssemblyLinearVelocity = Vector3.new(0,-10,0)
else
if #Parts == 1 then
local Part
for index, child in pairs(Parts) do
if child.Name == "SpawnBox" then
script.Parent.AssemblyLinearVelocity = Vector3.new(0,-3,0)
else
if child.Parent.Parent == script.Parent.Parent.Parent then script.Parent.AssemblyLinearVelocity = Vector3.new(0,-3,0) else
script.Parent.AssemblyLinearVelocity = Vector3.new(0,10,0)
end
end
end
else
script.Parent.AssemblyLinearVelocity = Vector3.new(0,10,0)
end
end
for index, child in pairs(Parts) do
if child.Anchored == false then
for i = 1,20 do
task.wait()
child.AssemblyLinearVelocity = Vector3.new(0,50,0)
end
end
end
end)
function isEmpty(t)
for i, v in t do
return false
end
return true
end
I dont see how I could really fix this, and wether its the hover or the gyro script for sure. would align orientation really fix it? if so, can you tell me whats better about it than what I did?
i did not know there was an abduction function in the hover script
anyway the align orientation kept it from smacking into stuff, so you could just keep that and see if it works
I generally just want a way to detect it, the glitching only happens if you get hit hard, so it won’t be often, my solution was to disable the scripts that make you hover and stay upright and you fall, and re stabilize. but I can’t detect it. is there a way to do that?
This didn’t seem to do anything, I think the reason is the hover script applying velocity. It somehow lags and adds extra velocity when you get hit hard, or some other reason layers it somehow, so I think what I need to do is limit the velocity.
So apparently the glitching was because the vehicle seat’s velocity somehow glitching out. im constantly changing the model’s velocity, so maybe something with the player is making it weird. either way, I got it reduced to minor vibrations that sometimes stop. and only start after a time of destruction. thanks for the help though =)