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

How to make a block move up 50 studs, wait 1 second, move down 50 studs, repeat? [closed]

Asked by 4 years ago

So I'm making a parkour game and at some point the block goes up, then down, and up, and down and you have to time it. The problem is I don't know anything about script so I had a friend helping me but his script tends to lag a lot. If you're having WiFi problems the obstacle will teleport and if you're on it, you'll fall through the obstacle. Someone told me try to use "body velocity" and it might help reduce lag. I don't really know how to do any of that. Could anyone help me do it?

2
no Lunaify 66 — 4y
0
no FlabbyBoiii 81 — 4y
0
lol jk, but could you please post the script your friend made you? It would be helpful to be able to edit something rather than to come up with it from scratch FlabbyBoiii 81 — 4y
0
Basically the do Markdrg 15 — 4y
0
CFrames or Vector3s dogefighter94 15 — 4y

Closed as Not Constructive by hiimgoodpack and Ziffixture

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Ok, so this is my first time helping someone but I recommend using TweenService Im not sure how much this will affect performance but ill give u an example below(in case u wanna use it)


local TweenService = game:GetService("TweenService") local part = WHATEVER PART local goal = {} goal.CFrame = Part.CFrame * CFrame.new(0, 50, 0) local tweenInfo = TweenInfo.new( 5, -- Time Enum.EasingStyle.Quart, -- EasingStyle Enum.EasingDirection.Out, -- EasingDirection -1, -- RepeatCount (when less than zero the tween will loop indefinitely) true, -- Reverses (tween will reverse once reaching it's goal) 1 -- DelayTime ) local tween = TweenService:Create(part, tweenInfo, goal) tween:Play()

I haven't tested this out so I 110% doubt it would work but its just to give u an idea if you want, u can check out some examples or tutorials on youtube or go read up on TweenService at

https://developer.roblox.com/en-us/api-reference/class/TweenService

so uhh this is my first post on this website so like later today ill edit it if I realise I can make it more appealing or if its breaking any rules

hope this helped

Ad
Log in to vote
0
Answered by 4 years ago

You might want to use CFrame.

local platform = script.Parent --Set this to the part you want to move up and down.

while true do --While loop repeats it
    for i = 0, 100 do
        platform.CFrame = platform.CFrame*CFrame.new(0, .5, 0) --Moves the platform up half a stud 100 times (total 50 studs)
        wait(.001)
    end
    for i = 0, 100 do
        platform.CFrame = platform.CFrame*CFrame.new(0, -.5, 0) --Moves the platform down half a stud 100 times (total 50 studs)
        wait(.001)
    end
    wait(.1) --Prevents while loop from crashing the game.
end
0
you might want to use cframe lerping for that or unless you want to yield the script from executing anything else 123nabilben123 499 — 4y