Services are being returned instead of connections

When I try assign a variable to a RBXScriptConnection, the variable for some reason isn’t actually a connection, but it’s a service or an event.


local function updateForce(dt)
    Gear.Propeller.ForcePart.BodyForce.Force = Gear.Propeller.ForcePart.CFrame:VectorToWorldSpace(Vector3.FromNormalId(Enum.NormalId.Front) * -15000)
connection = game:GetService("RunService").Heartbeat:Connect(updateForce)

and here I check if the connection is a connection, and disconnect if it is:

if typeof(connection) == "RBXScriptConnection" then

I know connection is a reference to RunService because of this:

If you can help, please reply to this topic.

It is an intellisense bug. Your connection variable actually points to the RBXScriptConnection created by :Connect.

There was a bug report on that but I can’t seem to find it at the moment.

1 Like

No i want the connection variable to be a RBXScriptConnection, so i can disconnect it.
the problem is that the variable is RunService


oh ok i cant read lol