Hi!
I have a part which is moved to a position using an AlignPosition constraint in OneAttachment mode on the client. While the position of the AlignPosition updates, it does not actually move the part to the required place.
Code (i’ve cut out the irrelevant parts, if you need more please say)
local Constraints = {
AlignPropCFrame = script.AlignPropCFrame,
}
local function CFrameAlignment(dt, Prop, ReplicatedProp, PropRotation)
local CameraCFrame = Camera:GetRenderCFrame()
local RequiredPropCFrame = CameraCFrame * CFrame.new(0, 0, -9)
Constraints.AlignPropCFrame.Position = RequiredPropCFrame.Position
end
local function ConfigureSystem(Prop, ReplicatedProp)
for i, v in pairs(Constraints) do
v.Attachment0 = Prop.Attachment
v.Parent = Prop
end
Constraints.AlignPropCFrame.Enabled = true
end
local function OnPromptTriggered(IsPropHeld)
ConfigureSystem(Prop, ReplicatedProp)
RunService:BindToRenderStep("IntialAlignment", Enum.RenderPriority.Input.Value, function(dt)
CFrameAlignment(dt, Prop, ReplicatedProp, PropRotation)
end)
end
I’ve tried two attachment mode, that’s also kinda broken. I would just manually set the CFrame of the part to the required position, but collisions of anchored parts wouldn’t register (all collisions besides for anchored ones are run on the client - it may sound weird but it’s necessary, trust me)
probably network ownership
i ran into that issue when converting my alignpos server scripts to client code. now i clone the parts at game start on client so client gets automatic ownership
Hm, interesting. I guess the best way to do this then is to have ReplicatedProp (cloned on client) as the one which has the constraint acting on it for anchored part collisions - which is why I need to use this constraint - and the regular Prop as the one for unanchored collisions (used as this eliminates the jittering of the part with the constraint - it just looks better)
Thanks for mentioning this, I’d have gone round in circles otherwise. I’ll try some things out and get back to you
Ok I did something and somehow it’s fixed again? I don’t really know what I did but it works. I did try this solution and it just broke something else so I’m not sure. I think the issue may also lie in how messy my code is right now, I really need to clean it up. Thanks anyway