I’m trying to make one of those game where 2 cars are connected with a rope (like “Chained Cars”). Problem: When i connect the two cars with a rope constraint, the player that sits first in its car, gets the network ownership of its car, the rope, and the other player’s car. And I don’t want this to happen
Video of what happens:
Both cars become green (meaning the player that sits first is the owner of the network) once i sit in one car, and i want both cars to be owned by different players. This happens because of the rope constraint but i dont know how to really fix it.
If there is other way of making a rope with collisions, let me know, but if you know the solution for this problem, let me know too.
NOTE
The rope is made by connecting two attachments, with parts that connects to other each other with rope constraints. So it’s not only one rope constraint.
Code used for this:
local KNOTS_AMOUNT = 30 -- number of spheres in the chain
local ROPE_THICKNESS = 0.2
local function InstantiateChain(origin, goal)
local startPosition = origin.WorldPosition
local endPosition = goal.WorldPosition
local direction = (endPosition - startPosition)
local totalDistance = direction.Magnitude
local segmentLength = totalDistance / KNOTS_AMOUNT
local chainModel = Instance.new("Model")
chainModel.Name = "Chain"
chainModel.Parent = workspace
local knots = {}
local attachments = {}
for i = 1, KNOTS_AMOUNT do
local alpha = i / KNOTS_AMOUNT
local position = startPosition:Lerp(endPosition, alpha)
local knot = Instance.new("Part")
knot.Name = "ChainKnot_" .. i
knot.Size = Vector3.new(KNOT_SCALE, KNOT_SCALE, KNOT_SCALE)
knot.Position = position
knot.Shape = Enum.PartType.Ball
knot.Material = Enum.Material.Metal
knot.Color = Color3.fromRGB(150, 150, 150)
knot.Anchored = false
knot.CanCollide = true
knot.Massless = true
knot.Parent = chainModel
knot.CollisionGroup = "Rope"
local attachment = Instance.new("Attachment")
attachment.Name = "RopeAttachment"
attachment.Parent = knot
knots[i] = knot
attachments[i] = attachment
end
local firstRope = Instance.new("RopeConstraint")
firstRope.Name = "RopeConstraint_Origin"
firstRope.Attachment0 = origin
firstRope.Attachment1 = attachments[1]
firstRope.Length = segmentLength * 1.2
firstRope.Thickness = ROPE_THICKNESS
firstRope.Enabled = true
firstRope.Visible = true
firstRope.Parent = knots[1]
for i = 2, KNOTS_AMOUNT do
local rope = Instance.new("RopeConstraint")
rope.Name = "RopeConstraint_" .. (i-1) .. "_to_" .. i
rope.Attachment0 = attachments[i-1]
rope.Attachment1 = attachments[i]
rope.Length = segmentLength * 1.2
rope.Visible = true
rope.Thickness = ROPE_THICKNESS
rope.Enabled = true
rope.Parent = knots[i]
end
local lastRope = Instance.new("RopeConstraint")
lastRope.Name = "RopeConstraint_Goal"
lastRope.Attachment0 = attachments[KNOTS_AMOUNT]
lastRope.Attachment1 = goal
lastRope.Length = segmentLength * 1.2
lastRope.Thickness = ROPE_THICKNESS
lastRope.Enabled = true
lastRope.Visible = true
lastRope.Parent = knots[KNOTS_AMOUNT]
return chainModel
end
InstantiateChain(script.Parent.Jeep.PrimaryPart.ChainConnector, script.Parent.Jeep1.PrimaryPart.ChainConnector)