a question that may be slightly off-topic, but is the primarypart of a character meant to be it’s head? i thought it was the HRP…
https://developer.roblox.com/en-us/api-reference/property/Model/PrimaryPart
Which in this case, is the HumanoidRootPart.
weird, whenever i join the game my primarypart is the head and not the humanoidrootpart
It’s the HumanoidRootPart, unless you modified it yourself.
Try this if anything:
print(Model.PrimaryPart)
i just opened an old project with a single tool in it to check if it’s something i changed, but it’s also head in this game
I think i found it.
for some reason, R6’s primary part is the Head, and for R15 it’s HumanoidRootPart
Seems like it is, for whatever reason.
you could always just use a BodyPosition. You will just parent the BodyPosition to the characters HumanoidRootPart, and set the Position Value of the BodyPostion to the desired Position. It will also smoothly tween it, and you can change the P and D properties to your liking.
can you provide an example of how this would be used? i don’t get how it works, i applied it but nothing happens
Here is a simple script that runs on the PlayerAdded.
game.Players.PlayerAdded:Connect(function(player)
local char = player.Character or player.CharacterAdded:Wait() -- Get the players Character
local hrp = char.HumanoidRootPart -- Get the HRP
wait(5) -- add a wait so that you can see the movement
local BP = Instance.new("BodyPosition", hrp) -- add a new BodyPosition to the hrp
BP.Position = Vector3.new(100,25,100) -- set the BodyPositions position
end)
works near perfectly how i wanted, thank you so much along with everyone else who helped
He wants to tween it I think. There’s no function like this
There’s no function like this
Yes there is.
Alternatively, a AlignPosition | Roblox Creator Documentation can make this possible.
This body mover has been superseded by AlignPosition
. It’s highly recommended that you use AlignPosition
for future work.
I know, but the BodyPosition is less complex, and can be used easier for beginners. It also works fine for just moving the character to a certain position.
and can be used easier for beginners.
It’s not complex once you learn how it works.
Let’s focus on teaching them the right way instead of using old methods.
Here are some:
:connect
→ :Connect
:wait
→ :Wait
wait(n)
→ task.wait(n)
spawn
→ task.spawn
Model:SetPrimaryPartCFrame()
→ Model:PivotTo()
BodyAngularVelocity
→ AngularVelocity
Yeah, You are right I concede my point. I dont really use constraints that much, so I don’t really understand them enough to tell someone to use them.
one thing i noticed is that when they approach the goal, they slow down. is there a way to prevent that?
Actually, I found a work-around for that.
Here’s an example:
local Players = game:GetService('Players')
local TargetPosition = Vector3.new(-515, 56.501, 26.25)
local BodyPosition = script.BodyPosition
local Debounce = false
local function Touched(hit)
local Player = Players:GetPlayerFromCharacter(hit.Parent)
if (Player)
then
local Character = Player.Character
if (Character)
then
local PrimaryPart = Character.PrimaryPart
if (PrimaryPart)
then
if (Debounce) then
return
end
Debounce = true
local Clone = BodyPosition:Clone()
Clone.Position = TargetPosition
Clone.Parent = PrimaryPart
repeat
task.wait()
until (PrimaryPart.Position - Clone.Position).Magnitude <= 10
Clone:Destroy()
Debounce = false
end
end
end
end
script.Parent.Touched:Connect(Touched)
Basically, the repeat loop will check the magnitude every frame (using Heartbeat).
You can then set the Vector3 further down (from its original Vector3), a few studs - so they land with a great speed at the end, since you’d be removing the BodyMover when it’s close enough to its goal (in studs), in this example it’s 10.
(You could also change the speed of the BodyMover, however they will still slow down at the end).
Do you have any proof or reference?
If you want to do something like that you’d probably want to just anchor the player’s torso (humanoidrootpart) and tween it
local VELOCITY_AMOUNT = 50 -- change if needed
local final_position = ... -- your position
local torso = humanoid.RootPart
local tweenTime = (final_position.Position - torso.Position).Magnitude / VELOCITY_AMOUNT -- velocity equaltoon
torso.Anchored = true
local tween = TweenService:Create(torso, TweenInfo.new(tweenTime), { CFrame = torso.CFrame.Position })
tween:Play()
tween.Completed:Wait()
torso.Anchored = false
character:MoveTo(torso.Position) -- optional, but prevents players from getting stuck in a certain area