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.

Script:

local function updateForce(dt)
    Gear.Propeller.ForcePart.BodyForce.Force = Gear.Propeller.ForcePart.CFrame:VectorToWorldSpace(Vector3.FromNormalId(Enum.NormalId.Front) * -15000)
end
	
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
    connection:Disconnect()
end

I know connection is a reference to RunService because of this:
https://gyazo.com/8d88cd85feaaa1bfec87955d622bca4d

If you can help, please reply to this topic.
Thx

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

See:

oh ok i cant read lol

30charsssssssssssssssssssss