Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make an object move with the player?

Asked by 5 years ago

Alright so basically I'm looking to make object's move with the player but not follow it smoothly. For an example the game SkyBlox

https://web.roblox.com/games/31434905/Skyblox

There is a glass barrier to prevent player's from getting away from their base

https://gyazo.com/532dc5f62681bde6c04ad959076e76d4

So what I want to make is have an item that move's around you, here is an example: https://gyazo.com/f7a187d7677a439ed47b55de60d0a1b1 But not exactly the same movement as the noob, if the noob goes forward 7 studs then the item will go 7 studs in the direction you went. This is what I want it for

https://gyazo.com/6567f9c29aed92c51e92ea4ee0fabc04

Imagine this as a huge grid, when the player moves forward as much as it's spacing (7 studs) so will the grid, therefore, making it appear as if it's an infinite grid.

I've been playing Roblox for 8 year's but I only recently started getting into scripting but please help me with this, I am getting into it but I want to make something with this :/

2 answers

Log in to vote
0
Answered by 5 years ago

there's not much specific information so everything I can give you is this, also I'm not very sure if there's other way to constantly update something's position.

while true do 
wait(0.01)
objects.position = game.Players.Player1.HumanoidRootPart.Position -- change player1 to what you want
end
Ad
Log in to vote
0
Answered by 5 years ago

The answer from DrewenoBrzozowe is not very performance friendly. The easiest way is to add a Part to the workspace, when a player enters the game (OnPlayerEntered:Connect event ) and then set the part position to the players humanoid and weld it to it. This way you dont have to update the function every second.

0
I think he means moving it in a way that is not smooth, in a way that makes the grid feel infinite. User#24228 0 — 5y

Answer this question