-
What do you want to achieve? I would like to allow a model with a level thingy with DragDetector move freely while the DragDetector is dragged. The hinge connecting the model and lever is used to get speed i need for the train thingy.
-
What is the issue? When the DragDetector is dragged, the physical movement is stopped.
I want to avoid this, and make it so that the model still moves when the DragDetector is dragged. -
What solutions have you tried so far? I tried doing something client-sided, but it doesn’t quite log the CurrentAngle of a hinge.
There’s my code for the movement:
local RS = game:GetService("RunService")
local TS = game:GetService("TweenService")
local TI = TweenInfo.new(15, Enum.EasingStyle.Quad)
local lever = script.Parent.Lever.HingeConstraint
local speed = script.Parent.Carriage.LinearVelocity
RS.Stepped:Connect(function()
local goal
if math.abs(lever.CurrentAngle) > 3 then
goal = {LineVelocity = 120*math.abs(lever.CurrentAngle)/100}
else
goal = {LineVelocity = 0}
end
local T = TS:Create(speed, TI, goal)
T:Play()
end)