Crane Constraints not Controlled

I scripted with a Breakdown Crane Controller, and it doesn’t do. So I created a Crane Controller script with constraints, look in my script:

local UpCraneButton = script.Parent.UpCraneButton
local DownCraneButton = script.Parent.DownCraneButton
local LiftUpButton = script.Parent.LiftUpButton
local LiftDownButton = script.Parent.LiftDownButton
local AttachButton = script.Parent.AttachButton

local Controlled = false

local BreakdownCrane = game.Workspace.BreakdownCrane

local ArmConstraint = BreakdownCrane.Arm:FindFirstChild("RopeConstraint")

local Hook = BreakdownCrane.Hook
local HookConstraint = Hook.CraneConstraint:FindFirstChild("RopeConstraint")

local TweenService = game:GetService("TweenService")

local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function()
	Controlled = true
end)

UserInputService.InputEnded:Connect(function()
	Controlled = false
end)

local function onArmControlled()
	ArmConstraint.Length = math.round(1)
end

local function ArmControlledDown()
	ArmConstraint.Length = math.round(-1)
end

local function onHookControlled()
	HookConstraint.Length = math.round(1)
end

local function HookControlledDown()
	HookConstraint.Length = math.round(-1)
end

LiftUpButton.MouseButton1Click:Connect(onArmControlled)
LiftDownButton.MouseButton1Click:Connect(ArmControlledDown)
UpCraneButton.MouseButton1Click:Connect(onHookControlled)
DownCraneButton.MouseButton1Click:Connect(HookControlledDown)

Does it seem I can’t control my Breakdown Train? So, show in my video:

Instantly, it can’t lift and attach with an arm and hook. How do I script the crane that can work?

1 Like

I don’t have enough info looking at this script

is this a script or local script?

  • if this is a script, it may not be reacting to the input events
  • if this is a local script, you’re currently trying to adjust physics things controlled by properties. so because of network ownership, since it’s probably handled by the server on a big crane, these would have no changes until the player walks close to the parts

and if it’s a local script, make sure it’s somewhere local scripts work