Players won't anchor?

First off don’t anchor humanoids, cancel there gravity force by using their mass times gravity. Also local player does not have a anchored property. Use a generic for loop and anchor v instead

There’s a problem. Here’s the issue: (the video)

robloxapp-20201104-1710399.wmv (2.0 MB)

There’s a lot wrong here. I’ll try to break it down.

The first thing is that the Player object does not have a Anchored property - you’d probably want to set this on the HumanoidRootPart child of their Character. I’d explain further but I think that’d distract from helping to explain the problem of the code you posted.

Next, you used the keyword until - but you did not use it with a repeat keyword. In Luau, until is meaningless unless it is paired with repeat in the form of repeat {statements} until {condition}. Quite literally, this means “keep repeating this set of statements until the given condition is truthy.” (I use the word “truthy” because, in Luau, a lot of things can be considered “true” in a condition that aren’t actually the boolean value of true.)

The other thing is that what would have been your condition in that script is a signal connection (that’s what :Connect(...) would return), which is considered truthy - so your statement would only run once, anyways.

Finally, you have the keyword then right after function() - this is syntactically incorrect. The keyword then is only meant for after a if-type clause (including elseif). In those cases, it means again quite literally as it reads - “if this condition is truthy, then do this set of statements.” It is meaningless next to a function() in Luau.

I think you have the right idea of how code generally works - you tell it what to do, when to do it, and what inputs to wait on. The problem seems mostly to be syntax and lack of familiarity with the language, which I think you can get easily based on the intuition you seem to have :slight_smile: I hope this post was helpful and I wish you the best of luck!

P.S. I think the single most helpful tool for you would be to check the Developer Hub’s API section to learn about what properties / functions / events exist for each class so that, once you know what you want, you can dig into the API and figure out what to do to make what you want happen.

1 Like

In this case, you don’t need to write a script with Anchor in the Customize button. Script the ‘Customize’ button separately and remove Anchor script from this button.