Event Part.NetworkOwnerChanged

Well my Changed event on the server seems to be only looking at this property “NetworkIsSleeping” nothing else is being fired from the Changed Event.

It fires twice when ship is being created, and seems to fire each time the network ownership is changed, so I can probably use this to check for it.

Code I used to get print statements.
function GS:ShipChanged(property,newship,oplayer)
print("Changed ",property)
if property == “NetworkOwnershipRuleBool” and newship and newship:FindFirstChild(“Main”) then
local isAuto = newship.Main:GetNetworkOwnershipAuto()
if isAuto then
print(“The server is automating the Network Ownership of”,newship.Main)
print(“The Network Ownership of”,newship.Main,“is being manually overridden.”)
print(“Current Owner:”,newship.Main:GetNetworkOwner())
if newship.Main:GetNetworkOwner() ~= oplayer then

newship.Main.Changed:connect(function(prop) GS:ShipChanged(prop,newship,oplayer) end)

also how to format code on here? for some reason it wont accept my indents.

Well testing it out, it seems fire inconstantly, some times it gets it right away, other times it never fires, or it fires 2-4 seconds after the ownership is switched.

However, it is in fact manually being overridden by the server:

Wait you’re saying Manual network ownership somehow fails when you hit the track? That makes no sense to me. How easy is this to repro?

I’m not sure how simple of a repro I can make, but when I hit the Track pretty much straight on it manually sets the Ownership of my Ship to nil (or the server), about 60% of the time, depending on how I hit the Ramp.

Link to place?

However, let me first make a Track that it can be easily reproducible on.

if you want to try to reproduce it on the track I currently am, you will have to hit the “Find Servers” button on the right side of gui, and then hit the Join button (which is kind of hidden, currently going under GUI redesigning). Once in the new server you just need to “ready up” and the vote for the “Tunrac” track

Video of reproducing it:

In this video I have a while loop on wait(.1) that is fixing the ownership, but as you can see it fixes it too late, as the ship has already been launched into orbit.

Ok I made a pretty easy to reproduce track, Just do as posted above but vote for “TestTrack1”. To reproduce just keep driving straight into the Hills while boosting (spacebar). The faster you are going, the higher the chance it occurs. I also find it somewhat easier to reproduce if you drive on the track backwards on the smaller hill.
Edit: I also disabled the while loop that is trying to fix it, so you can notice it more. You can hit R to respawn the ship which will fix the ownership.

The only thing I can think of that could be causing it is a bad cframe being set to the BodyGyro, which orients the ship.

How do I make this game work in Start Server + Start Player? Once I got through the DataStore errors by publishing (It’s in an inactive place, so don’t worry) it won’t let me join a Race because the server ID is 0.

Does not have an ID
Does not have an ID

In the MatchMakingS module Script, you need to replace the placeId in the CreatePlaceAsync Function to a Place that can be copied by and is apart of the game. For example you can just upload the exact clone of the place to another place in the universe and allow it to be used as a template for CreatePlaceAsync (I have gotten around to replacing this with Reserved Servers yet).

Also you will probably need to copy these models and upload them so your game has access to them.

as long as you don’t vote for Tunrac or Lorizo you should be fine with just the TestTrack1 model.

Edit: actually does CreatePlaceAsync work in Studio, I can’t seem to get it to run either, I don’t normally test this game in Studio.

Hmmm, CreatePlaceAsync probably doesn’t because it would require us to be able to connect with a live server from Studio.

ok I made the Test track the Default Track, so all you need to do is hit “Ships” then “Test Ship”, don’t even need to take the Model.

So I have it spawning me now, but the ship won’t go forward. Is there like a “Go” button or am I missing something?

oh, here are the controls

Mouse and Keyboard controls:
Left Click = gas
Right Click = brake
Move mouse Left and right = steer
A and D = Straf
W and S = Tilt (when airborne)
Spacebar = Boost
T = Give Boost (for testing)
R = reset Ship
P = back to Menu

Gamepad controls:
RT = gas
LT = brake
Left Joystick = Steer
Right Joystick = Straf/Tilt
LB = Boost
X = Give Boost (for testing)
Select = Reset ship
Start = go back to menu

Tablet Controls:
Touch/Hold bottom right corner = gas
Touch/Hold bottom left corner = brake
Rotate Device = Steer
Slide gas finger = Straf/Tilt
Tap middle left = Boost
Tap top right = give boost
Double tap bottom middle = reset ship
Swipe down from middle top = go to menu

Although the steering for Mobile is currently not working.

Also it helps to hold down W so that the ship tries to stay on the ground.

Heres me reproducing it on this track:

Although I also find the back side of the first hill to be equal likelihood of happening too.

Finally got a repro. Okay, I think I know what is going on. For some reason your high-speed collision with the wall causes the part to explode/teleport due to an over-constraint problem (not quite sure yet). When this part teleports, it seems to teleport in the negative direction (below -500) where the kill plane logic takes place.

Kill Plane logic

  • Detect that I am below kill plane.
  • Set my ownership to server to verify.
  • Server receives ownership and deletes you if you are below the kill plane.

What happens in your game

  • Collision causes crazy teleport below kill plane.
  • Set ownership of ship to server.
  • Server receives ownership but never gets a position update from the client, so it uses the last position that it verified.
  • Once the server is owner it sends you an update about how the ship is still on the track.

You need to somehow prevent that crazy 90 degree collision. And I gotta figure out why it teleports you.

Side-note: I appreciate another Blue Stahli and Celldweller fan, but be careful with copyrighted music :stuck_out_tongue:

Please tell me you guys aren’t using NetworkOwnershipRuleBool in normal non-debugging logic. The only reason that property name exists is because we found a bug in some replication code that prevented me from adding a new Enum value so I replicated it as a Boolean to prevent Xbox code form going weird even when running an older version. I’m going to switch it back to Enum replication soon and the name NetworkOwnershipRuleBool is going to be invalid.


Thank-you for your time on this. Do you think possibly setting a bad CFrame to the BodyGyro could be causing the Ship to say flip out and teleport to negative infinity, thus being killed by the Plane? Also I have the killing Plane set to the lowest possible value -50000, so my guess it has to do with the BodyGyro.

Edit: Oh also I am using Legacy Physics if that changes anything.

Also it doesn’t have to be a a >80 degree angle for it to occur, it is just easily producible at steeper angles (example is the second Video I posted, which is like about 60 degree angle).

This is the Code I use to decide the rotation:

[code] --norm is the upwards direction of the Surface, detected using Rays from below the Ship.
local ny = norm.unit
local o = ship.Main.CFrame.p
local ncc = ship.Main.CFrame:vectorToObjectSpace(ny)
–local nzo = Vector3.new(0,-ncc.z,ncc.y)
–local nxo = Vector3.new(ncc.y,-ncc.x,0)
local nzo = Vector3.new(0,-ncc.z,ncc.y).unit
local nxo = ncc:Cross(nzo)
local nz = ship.Main.CFrame:vectorToWorldSpace(nzo)
local nx = ship.Main.CFrame:vectorToWorldSpace(nxo)
M.gyro = CFrame.new(o.x,o.y,o.z,nx.x,ny.x,nz.x,nx.y,ny.y,nz.y,nx.z,ny.z,nz.z)

-- much code later
ship.Main.BodyGyro.cframe = M.gyro * CFrame.fromEulerAnglesXYZ(0,steering/30,0)
-- where steering ranges from like -70 to 70


Are you doing anything to make sure that the rotation matrix is orthonormal? You’re doing a lot of cross products to generate a very custom rotation matrix.

If the bases are not orthonormal, and the determinant != 1, bad things can happen.

Nah I’m not, I just found it by accident while I was testing some stuff.

You guys should maybe fix that bug. Sometimes internal properties are exposed through Instance.Changed

I’ve discovered several secret properties, such as

  • BasePart.DraggingV1
  • Humanoid.Health_XML
  • Humanoid.JumpReplicate
  • FormFactorPart.formFactorRaw

I’m pretty sure I figured it out, somehow my BodyGyro’s CFrame was being set to NANx12. I use 2 different Ray’s to to determine how the Ship should orient itself, one pointing below the ship, the other pointing straight ahead (to detect sharp hills). Some how the 2 normals returned by the rays were opposite of each other, and so my equation to find a normal between the two normals (so as to make a smooth transition from normal 1 to normal 2) was canceling out to 0,0,0. So in my above code I posted, ny would be nan nan nan therefor M.gyro would be NANx12, which when set to a BodyGyro causes the ship to be flung to negative infinity.

NAN would do it. Oh god the NANs.

This would be very useful still in scenarios where we are applying forces/constraints which we could calculate on any client/server (because it would be more efficient to distribute the load than have one machine calculate everything)

For example I have these item drops which are right now only owned by the server