Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My Pad Teleport won't make the pad lower down. (simple script)?

I'm having trouble with my pad teleport to teleport to this other part constantly at the right height (y value) here's the script:

while true do
	script.Parent.Position = script.Parent.Parent.Give.Position.Y(2.1) -- I need it to teleport lower
	wait(0.001)
end

1 answer

✓ Accepted answer

You can add and subtract vector3 values, so we can take advantage of that to make that work.

object.Position -= Vector3.new(0, 2.1, 0) -- this will subtract
object.Position += Vector3.new(0, 2.1, 0) -- this will add

If you want it to go up you need to add, and if you want it to go down, you subtract it. If it doesn't perfectly match, just try increasing the 2.1 value or decreasing, until it perfectly matches. So here is your script implementing that:

while true do
    script.Parent.Position -= Vector3.new(0, 2.1, 0) -- subtracting makes it lower, so we are using that
    wait(0.001)
end

Edit: it was going down forever because I was subtracting it from the same part, it needs to be subtracted from script.Parent.Parent.Give.Position. Here is the fixed (probably) script:

while true do
	script.Parent.Position = script.Parent.Parent.Give.Position - Vector3.new(0, 2.1, 0)
	wait(0.001)
end

In this one we don't need to do -= as it's not subracting from itself

15 comments

0

Thanks, you've shown me so much on how to code through these past few questions, thanks (:

0

No problem!

0

Ahh wait, It's not working.

0

What is exactly the problem?

0

It keeps on flying into the air, never stopping

0

It probably is because the wait() is too short, or "script.Parent" is also flying in the air

0

I checked it but it's still going down forever

0

Maybe we should use an event when them give position changes the pad moves there

0

Let me test a script using that rq

0

rq?#

0

rq means right quick, and I edited the script

0

ok

0

It worked, thanks so much. I've added another question about 4 hours ago about a food that a player eats and it gives them a speed boost. If u know how to deal with tools that would be great.

0

Yeah, I'll look into that

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.