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

Slowing down model movement? [Need this solved HELP]

I when you press a brick the model moves upwards but i want it to be more of a slow movement than a fast movement.

Any help?

local model = game.Workspace["Door4"]; -- The model you want to move up
local increment = 0.5 --The amount you want it to go up by each time
local max = 10 --The studs you want to go up by
local Button = script.Parent.ClickDetector --Change this to the ClickDetector.
local closed = true
local isMoving = false

function onClick()
    if isMoving == false then
        isMoving  = true
            if closed then
                move = increment 
            else 
                move = -increment 
            end 
            closed = not closed
            for i=1, max/increment do
                model:TranslateBy(Vector3.new(0,move,0));
            wait(1/60)
            end
        isMoving = false
    end
end

Button.MouseClick:connect(onClick) ;

1 answer

On line 25 where you try to call the function it should be Button.MouseButton1Click:connect(onClick). MouseButton1Click is when people click the left button on the mouse. MouseButton2Click is when people click the left button on the mouse. I have no idea why you put a semi-colon at the end. If it still does not work just look at the ROBLOX wiki.

Button.MouseButton1Click:connect(onClick)

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