How would I anchor a part without setting Anchoring Property to true

How would I anchor a part without having to set the property to true. This is because im trying to script some VFX and want to setnetworkownership which requires the part to be not anchored. If there are any alternate solutions please let me know! Thanks in advance! :slight_smile:

1 Like

You can either weld it to an anchored part or set its position to default every frame

1 Like

They are somewhat mutually exclusive. Network ownership is used to dictate which client (or server) will calculate the physics. An anchored part has no physics. What exactly are you trying to accomplish by setting network ownership of an anchored part? You can still set the network ownership of an assembly which includes welded parts if that’s what you’re trying to do, but that’s not the same as anchored.

1 Like

Im trying to tween a object a certain way and the tween wont work unless the part is anchored (it falls off the map)

1 Like

Insert a bodyvelocity object inside the part with its velocity vector set to 0,0,0

1 Like

Okay ill try this and let you know how it goes thanks!

1 Like

Okay the model is slowly going down how would I resolve this? (massless is true)

1 Like

Here’s what I would do:

local RS = game:GetService("RunService")
local vector_zero = Vector3.zero

RS.RenderStepped:Connect(function()
    part.AssemblyLinearVelocity = vector_zero
    part.AssemblyAngularVelocity = vector_zero
end)
local RS = game:GetService("RunService")
local cframe = part.CFrame

RS.RenderStepped:Connect(function()
    part.CFrame = cframe
end)

Either of these work. It’s your choice.

1 Like

The problem is that it would reset the CFrame of the object every frame, but I would need to tween the object, this would contradict each other right? Correct me if im wrong

1 Like

Create a BodyVelocity, set its velocity to 0, 0, 0 and maxforce to a massive value in all axes.
If you need to also prevent it from rotating, insert a BodyGyro and change its maxtorque to a massive value in all axes as well.

2 Likes

Generally the way most programmers do this is by setting up and event and executing a server side script to make it do what the client is telling it to do. For the sake of the question though, you could do like @aliaun125 said about the welding or the frame by frame positioning, and you could also try adding a bodyForce and bodyGyro that maintains the object’s current position and orientation.

To do this exactly the way you are describing above however, your best bet would probably be to unanchor it via the server script, immediately give said client network ownership, and then have the client anchor it from the client side. This way it should remain unanchored to the server (the server would only see that the client is holding it still, not that the client is anchoring it) and then you could tween it as you please.

(Edit: to make this go as smoothly as possible, you would probably want the client to have it anchored from the get go so that by the time the client has ownership of it, it is already anchored and the client doesnt have it fall out of position or anything like that)

1 Like

Keep AlignPosition and its maxforce to inf, and keep the position of AlignPosition to the block position, and it wont fall down, just like anchored block

1 Like

It worked but would it also replicate to the server (so everyone else can see it?), also the tween doesnt really work properly and it just falls down a bit then stops. Thanks in advance!

So after doing some reading up on roblox API, it seems that SetNetworkOwner() doesnt actually give the client permission to move the object directly, it just makes that client’s computer do all the physics calculation for that object rather than the server doing it. (through testing, ive found that you actually can anchor it on the client and that will replicate to the server, but any other physics changes will not work, which is odd.)

This means that the method you are trying to do will not work. What you can do is use remoteEvents to make it move on the server. For example:

  • Make a remoteEvent, put in workspace for now
  • use [name of the remoteEvent]:fireServer() in the localScript when you want it to do the thing.
  • use [name of the remoteEvent].OnServerEvent:Connect(function() [[[your code here]]] end) to do what the localscript is telling you to do on the server
2 Likes

Wow thanks for the information, appreciate it! :slight_smile:

1 Like

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