it works good, but how do I achieve it anchoring? without… anchoring it?
You need an AlignPosition constraint. You have to set it’s target position property to the Root parts position so that it can’t move but can rotate just fine.
Im a new dev and this is my first attempt at making a ability, I remember someone telling me to do this but research didn’t really explain it to me, how do I do this?
how do I add one and change the target to the root part?
You need an attachment inside the root part, after that just make one and set the attachment1 to root parts attachment and just set the target position to the root parts position.
EDIT: You can refer to this thread.
Thank you!!!
Unable to assign property Position. Vector3 expected, got CFrame
this is my code for assigning position
local anchor = Instance.new("AlignPosition")
local rootattach = Instance.new("Attachment")
rootattach.Parent = root
anchor.Attachment1 = rootattach
anchor.Position = CFrame.new((root.CFrame.Position))
You are trying to assign a CFrame value on line 5, remove the CFrame.new()
call.
EDIT: It needs to be anchor.Position = root.Position
how do I set position then?
(20 char limit)
It needs to be anchor.Position = root.Position
not working im clearly unanchored still and im clipping in ground
Oops, you need to set the Attachment0 not Attachment1 lol
still not working, didn’t change anything
Hmm, did you set the AlignPosition Constraints parent?
I don’t think so, the whole script that does that I sent aka this one:
local anchor = Instance.new("AlignPosition")
local rootattach = Instance.new("Attachment")
rootattach.Parent = root
anchor.Attachment0 = rootattach
anchor.Position = root.Position
This might be a stupid question, but are you doing this on the server?
nope, also how would I do this on the server?
You need to restructure your code:
Step 1. Add another remote event that is called when input begins
Step 2. Connect to that event on the server and inside the connection put this:
local RootPart = Character.HumanoidRootPart
local AlignPos = Instance.new("AlignPosition")
local AlignAttachment = Instance.new("Attachment")
AlignAttachment.Parent = RootPart
AlignPos.Parent = RootPart
AlignPos.MaxForce = 10e38
AlignPos.Responsiveness = 10e38
AlignPos.Mode = Enum.PositionAlignmentMode.OneAttachment
AlignPos.Attachment0 = AlignAttachment
AlignPos.Position = RootPart.Position
Note: You need to destroy the constraint and the attachment on the second remote event call.
It still doesn’t work and also I did destroy it afterwards