Roblox Central

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Roblox Central

Discussion for all things Roblox. (roblox.com)

Welcome to the new forum! Any suggestions you have are greatly appreciated.
WARNING: Before referring anyone to this website, Please read this topic

3 posters

    Elevator Scripting

    avatar
    Jfeather
    Admin


    Posts : 232
    Join date : 2009-06-18
    Location : This Forum. Duh.

    Elevator Scripting Empty Elevator Scripting

    Post by Jfeather Sun Aug 30, 2009 8:05 pm

    Code:
    b = script.Parent

    floor = script.Floor
    floor.Value = 0

    pos0 = b.Position
    pos1 = game.Workspace.Brick1.Position
    pos2 = game.Workspace.Brick2.Position

    Table = {pos0,pos1,pos2}



    while true do
    wait()
    projectposition = Table[floor.Value + 1]
    if projectposition == b.Position then
    --b.BodyVelocity.velocity = Vector3.new(0,0,0)
    script.dir.Value = 0
    end
    if script.dir.Value == 0 then
    b.BodyVelocity.velocity = Vector3.new(0,0,0)


    elseif script.dir.Value == 1 then
    b.BodyVelocity.velocity = Vector3.new(0,10,0)

    elseif script.dir.Value == 2 then
    b.BodyVelocity.velocity = Vector3.new(0,-10,0)
    end
    end


    Is there anything theoretically wrong with this script? Please note dir and Floor are NumValues inside this script, and methods to change these are not included.
    Earth
    Earth
    Admin


    Posts : 402
    Join date : 2009-06-18
    Location : According to my IP address: Topeka, Kansas.

    Elevator Scripting Empty Re: Elevator Scripting

    Post by Earth Mon Aug 31, 2009 1:25 pm

    I'd use a bodyposition or CFrame you down instead of velocity.


    Also this...

    projectposition = Table[floor.Value + 1]

    Not sure what your doing here...


    Comments are your friends.
    avatar
    Jfeather
    Admin


    Posts : 232
    Join date : 2009-06-18
    Location : This Forum. Duh.

    Elevator Scripting Empty Re: Elevator Scripting

    Post by Jfeather Mon Aug 31, 2009 7:08 pm

    Earth wrote:I'd use a bodyposition or CFrame you down instead of velocity.


    Also this...

    projectposition = Table[floor.Value + 1]

    Not sure what your doing here...


    Comments are your friends.


    I already have a working one with BodyPosition, but I wanted to make a smooth moving one instead of a suddenly moving one.

    project position is the the variable of where the brick is trying to go, for example, if floor's value is 1, then it adds one, gets 2, goes to Table[2], which is pos1. pos1 == Brick1's position, or in other words, where I want the moving brick to stop.


    Kind of confusing, but I made it this way so you could easily add and remove floors if it actually worked...which.. it didn't.
    Earth
    Earth
    Admin


    Posts : 402
    Join date : 2009-06-18
    Location : According to my IP address: Topeka, Kansas.

    Elevator Scripting Empty Re: Elevator Scripting

    Post by Earth Tue Sep 01, 2009 1:34 pm

    Ah. I would like to suggest CFraming. Or BodyVelocity then.
    BlueTaslem
    BlueTaslem
    Learning the Ropes
    Learning the Ropes


    Posts : 32
    Join date : 2009-09-03

    Elevator Scripting Empty Re: Elevator Scripting

    Post by BlueTaslem Fri Sep 04, 2009 10:40 am

    I hvae one suggestion:
    Anchor the brick, and make the first line of the script be:
    script.Parent.Anchored = false


    The BodyObjects activate before the Scriptservice does, so the positions it reads off its parent's position might be in the wrong place if your BodyPosition starts with a posiion of Vector3.new(0,50,0)
    avatar
    Jfeather
    Admin


    Posts : 232
    Join date : 2009-06-18
    Location : This Forum. Duh.

    Elevator Scripting Empty Re: Elevator Scripting

    Post by Jfeather Sun Sep 06, 2009 7:41 pm

    BlueTaslem wrote:I hvae one suggestion:
    Anchor the brick, and make the first line of the script be:
    script.Parent.Anchored = false


    The BodyObjects activate before the Scriptservice does, so the positions it reads off its parent's position might be in the wrong place if your BodyPosition starts with a posiion of Vector3.new(0,50,0)


    Wow, never considered that- thanks. I'll try it out soon and get back to you guys.

    Sponsored content


    Elevator Scripting Empty Re: Elevator Scripting

    Post by Sponsored content


      Current date/time is Fri Apr 26, 2024 3:11 am