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

Moving models to different area on load?

Asked by
Cuvette 246 Moderation Voter
8 years ago

Hard one to explain, but basically i'm working on a game where you can own a plot of land, find the materials to build on it and it saves when you leave the game. The only problems is, when the player rejoins the game and moves to another plot of land to load their progress, The models from their previous save spawn in the old plot of land and not the new one.

What is the best way to get those models to load in on any plot of land no matter what rotational variant or x,y,z coordinate?

(Also if anyone knows have to create a ClickDetector in a script without manually doing it through studio that would be great to know)

Thanks!

1 answer

Log in to vote
1
Answered by 8 years ago

Relativity

When you save everything, save it relative to a point on the plot of land. Then, when you load everything, load it relative to the same point on the new plot of land. This sort of stuff is local space.

Not sure about how to do it? If you're using the Position, it's simple because you just use the difference. If you're using CFrames, you can use the ToLocalSpace method for each part and then load it with ToWorldSpace.

0
Ah nice! You've pretty much given me quite a few ideas i'm going to put it to work now, thanks. Cuvette 246 — 8y
Ad

Answer this question