I’ve been trying to figure out for the past 30 minutes about WHY this single issue has been tormenting my patience and how it keeps being there after I’ve tried EVERYTHING.
Ok so, my game has a script that allows you to teleport between checkpoints that you have reached and checkpoint 0 is spawn (since technically it doesn’t count as a checkpoint but rather as an actual spawn.)
There’s one issue I’ve had and it’s when you teleport to the spawn part. Your character kind of clips into the ground before going back up but the rest of the checkpoints don’t do that. Here’s my script:
if currentcheckpoint == 0 then
player.Character:MoveTo(workspace.Spawn.Position)
else
player.Character:MoveTo(checkpoints[currentcheckpoint].Position)
end
Keep in mind, they both use :MoveTo() to achieve the desired result.
I have tried every possible solution I had in mind in order to try and fix, yet they didn’t work.
Changing the spawn for a checkpoint part (copy and pasted)
Resizing, moving and rotating the part
Change the requirement from ==0 to ~=0 in the script
Putting the spawn inside of the checkpoint’s folder
Can someone PLEASE find a solution to this?? I am gonna lose my head over this.
Why are you using MoveTo? It’s already buggy. Use RootPart.CFrame = CFrame.new(checkPoint.Position+Vector3.new(0,Humanoid.HipHeight,0))*RootPart.CFrame.Rotation
I use it since it’s basically how I want players to teleport. If the only solution would be to use something else rather than :MoveTo() then it’s just stupid but I guess it would be the only way…
I did think of that but OP is switching between the 2 points pretty fast and they did this multiple times. This couldn’t mean it unloads and loads every single time now right? It should only happen once.
Maybe if you cooperate with us and try using our methods then maybe you will save ours and yours sanity. Alright?
Yeah, I know that. I am just correcting SeargentAUS here.
Pretty sure you aren’t the one who solved this issue now right? It was @SeargentAUS and me who actually gave you the answer. It is recommended that you mark either mine or their reply as the solution rather than yours.
@SeargentAUS suggested the Vector3 solution and after a bit of tweaking, it worked.
Your script didn’t work as expected and I didn’t wanted CFrame to be in there, just simple positioning.
I’m used to marking my own posts as solutions when I eventually figured out when no one replies to my post (or haven’t figured out how to do it) so it probably carried over. It would go to them since that one worked.
I was being sarcastic for you marking your own post as a solution, taking the credit.
I noticed that it was just going to result in some positioning matter, yet I suggested the use of root part because you never know when roblox would randomly deprecate Model:MoveTo just like they did with Mode;SetPrimaryPartCFrame. It’s also common practice to use RootPart.CFrame. But, like I care, it’s your game. Go crazy with it, not going to shove my opinions on ya.
Maybe it’s because you don’t end up providing enough information? A good way to get your issue solved is to provide as much information as you can.
I’ve always used simple ways of positioning stuff since I’m the type of person who get’s work done pretty lazily and quickly (unless if it’s meant to be a serious game)
I just tend to poke around with my script in the meantime waiting for an answer and then I eventually figure out the solution on my own.
I see there’s already a solution, but there still seems to be a lot of confusion.
There’s nothing necessarily wrong with using MoveTo. It’s not “buggy”, it just moves whatever model that was moved up until there aren’t any obstructions blocking the model. It says so in the documentation. So, this is actually expected behavior. @SeargentAUS 's solution is what you should be doing for every spawn, really.
This isn’t happening because the SpawnLocation isn’t fully loaded either, as you’d otherwise be getting an error for trying to access something that doesn’t exist yet.
At the end of the day, using MoveTo, setting the primary part’s CFrame directly, or using PivotTo are all valid ways of doing this, you just need to be mindful of the fact that without offsetting the position you’re moving the root part to, you’re cramming the center of the player into the center of the spawn location.
*if you are teleporting locally.
Very important, especially on larger maps with StreamingEnabled, to ensure parts you’re teleporting to have loaded in on that client- server side teleports won’t error, but the object doesn’t exist on the client.