How can i keep a part under the player's feet?

I want to make a part that is gonna be on the player’s feet without having to constraint it. The player should be able to jump and stuff without it under the player’s feet but otherwise it should be stuck to the player’s foot. How can I do this?

1 Like

If you really do not wish to use a WeldConstraint, you can simply use the older alternative, a Weld.

wouldn’t weld just also just force it to be under the players feet when you jump as well?

My bad, didnt read that last part. Im a bit confused, what sort of effect are you trying to achieve?

kinda make it so that it looks like the map just follows you so that ur still moving, the map is just moving with you

Edit: I am not sure if I misinterpreted the part of the post where the platform would be “stuck to the player’s foot” or not, so keep that in mind when looking through these resources. Regardless, what is provided here could act as pointers / the first steps toward achieving what was described in the original post.


It’s possible to achieve that effect through Raycasting, which is what Jailbreak and The Wild West have utilized for the trains in their games.


I’ve gone through the process of creating platforms that move with the player with the help of an existing topic on the Developer Forum. Here are two posts of mine that detail the process of creating that feature, including the problems I encountered and working code that makes the effect possible:

You can make a localscript so whenever a player jumps it keeps it at last recorded altitude.

This is laggy by like a fraction of a second. Not sure if that can be averted, but if so I’ll let someone else brush it up properly. But is this what you’re looking for in general? Put it in a Server Script and try it out. (Only works with R6)

game.Players.PlayerAdded:connect(function(p)
	repeat wait() until p.Character
	
	local Brick = Instance.new'Part'
	Brick.Anchored = true
	Brick.Parent = p.Character
	Brick.Size = Vector3.new(3, .2, 3)
	Brick.CanCollide = false
	
	local Torso = p.Character.Torso
	
	while wait() do
		Brick.Position = Vector3.new(Torso.Position.X, Torso.Position.Y - 3, Torso.Position.Z)
	end
end)

made it r15 compatible. it IS what I’m looking for but, for some apparently reason when you stop moving it looks like the player is skidding a little bit. fix?

Could try changing it from Position to CFrame.

I did, the skidding effect still happens

Then use the HumanoidRootPart as the point of reference instead of the Torso, because I believe the Torso always has an animation playing, which might be what’s causing your skidding issue.

so i made a different script locally using hrp, and it works, but it doesn’t really feel like the player is moving at all. here is the script.

local Torso = script.Parent.HumanoidRootPart
game:GetService("RunService").RenderStepped:Connect(function()
	workspace.Baseplate.CFrame = CFrame.new(Torso.CFrame.X, -10, Torso.CFrame.Z)
end)

What do you mean by the player isn’t moving at all?

the player IS moving, it looks like it’s not however

Here you go.

You will now still be able to jump and it doesn’t stick to your character.
It also orients properly and shouldn’t lag.

--!strict

local character: any = game:GetService("Players").LocalPlayer.Character
local humanoidRootPart: any = character.HumanoidRootPart

local mover: Part = Instance.new("Part")
mover.Anchored = true
mover.Size = Vector3.new(3, 1, 3)
mover.CanCollide = false
mover.Parent = game:GetService("Workspace")

local moverSizeCalc: number = mover.Size.Y * .5

local rate: number = 0.01 -- 100 times a second
local accumulated: number = 0

game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
	accumulated += deltaTime
	while accumulated >= rate do
		accumulated -= rate
		mover.Position = Vector3.new(
			humanoidRootPart.Position.X, 
			moverSizeCalc,
			humanoidRootPart.Position.Z
		)
		mover.Orientation = humanoidRootPart.Orientation
	end
end)

Put this into StarterPlayer → StarterCharacterScripts as a LocalScript.

1 Like

is the instance.new the part attached to the foot? if so how can i switch it to baseplate? i tried to do

local mover = workspace.Baseplate

but the baseplate just got deleted somehow.

Here’s how it looks like, I may have misunderstood if this is not to your specifications:
herethis

1 Like

yes, this is what it should look like except without a part and just with the baseplate.

Here are the modifications to the script.

Assuming your baseplate is called “Baseplate” and is in Workspace, then this should work.
Feel free to remove the orientation part in the script to disable orientation updates.

--!strict

local character: any = game:GetService("Players").LocalPlayer.Character
local humanoidRootPart: any = character.HumanoidRootPart

local mover: any = game:GetService("Workspace"):WaitForChild("Baseplate", 3)

local rate: number = 0.01 -- 10 times a second
local accumulated: number = 0

game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
	accumulated += deltaTime
	while accumulated >= rate do
		accumulated -= rate
		mover.Position = Vector3.new(
			humanoidRootPart.Position.X, 
			0,
			humanoidRootPart.Position.Z
		)
		mover.Orientation = humanoidRootPart.Orientation
	end
end)

What is this for out of curiosity? :smiley: