HingeConstraints changing AngularVelocity from Client Issue

  1. What do you want to achieve? Keep it simple and clear!
    Hello, so i’m making a game. It has small cutscene for a building with spinning things anchored to part which is connected with root(small 1x1x1 part) via HingeConstraint.

So, i’m increasing angular velocity of HingeConstraint with script(Because i want it to speed up until it will equal 10, not just keep linear speed). But it don’t work in Cutscenes script(which is client). Hinge constraint starts acting very weird. First, it will do nothing even if AngularVelo is 10 already, after some time(for some unknown reason) it will actually start spinning(nothing triggers it, just some random moment). And yes, i can’t use ServerSide for this. There is a reason why it is client, all buildings are unique for each player and generated from client(moved from ReplicatedStorage upon unlocking). While i test it as server side in test place, it works perfectly fine.
2. What is the issue? Include screenshots / videos if possible!
Here i provide a video of how it should be, when running from server: https://drive.google.com/file/d/10HxhHkQ_bGfsSZdZ-Uw2Aj8ADwHwDQiS/view?usp=sharing
Here what happens upon loading actual cutscene from client:
https://drive.google.com/file/d/1KBoQPcJVXbEVS6HFuSACJE_aNjn9TpZe/view?usp=sharing

As you can see HingeConstraint acts really weird.
3. What solutions have you tried so far? Did you look for solutions on the Creator Hub?
I tryed Enabling/Disabling in a loop, Updating it Attachments, it just doesn’t care

Here is code:

local Building = workspace.Map.Buildings.PU_Building
local UpperPart = Building.UpperPart

local root = UpperPart.Root
local HingeConst = root.HingeConstraint

local Photons = UpperPart.Photons

local BeamBottomRoot = UpperPart.BeamBottomRoot

local VFX = ReplicatedStorage.VFX
local PU_Laser = VFX.PU_Laser
					
local function EnableBeams()
	for _, photonBeam in ipairs(Photons:GetDescendants()) do
		if photonBeam:IsA("Beam") then
			coroutine.wrap(function()
				local attach = Instance.new("Attachment")
				attach.Parent   = photonBeam.Parent
				attach.Position = photonBeam.Attachment0.Position
				photonBeam.Attachment1 = attach
				local worldTargetCFrame= BeamBottomRoot.Attachment.WorldCFrame
				local localOffset = attach.Parent.CFrame:PointToObjectSpace(worldTargetCFrame.Position)

				local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
				local goal = {Position = localOffset}
				local tw = TweenService:Create(attach, tweenInfo, goal)
				tw:Play()
				PU_Laser:Clone().Parent = attach
				tw.Completed:Wait()

				photonBeam.Attachment1 = BeamBottomRoot.Attachment
				BeamBottomRoot.Attachment.ParticleEmitter.Enabled = true
				attach:Destroy()
				end)()
			end
		end
	end
	print("Settings Attach")
        --Here HingeConstraint gets velocity change
	UpperPart.Root.HingeConstraint.Attachment0 = UpperPart.Root.Attachment0
	UpperPart.Root.HingeConstraint.Attachment1 = UpperPart.Body.Attachment1
	task.wait(.1)
	local conn
	conn = RunService.Stepped:Connect(function()
		HingeConst.AngularVelocity += .01
		print(HingeConst.AngularVelocity)
		if HingeConst.AngularVelocity >= 10 then
			print("Enabling")
			EnableBeams()
			conn:Disconnect()
		end
	end)
...

Bumping this one. I also tryed using Client RunContext in test place and same issue persists

I just figured what it starts spinning only after whole function ends for some reason, but i don’t really update any attachment connected with body(which should spin) or smth

So, new update. I tryed reversing all cutscene, and making it run passive when game started(like already angularVelo to 10) and then on first building unlock just set angular velo to 0 at loading. And it same don’t work, absolutely same things happens, but reversed. Now upon setting angularVelo to 0, it still spins with 10 for a while and only then stops. This is like some physics of hinge constr getting loaded or smth with a big delay around 10 seconds, only after them it starts to accept property updates

Just solved it by manually updating CFrame of Root part by math

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.