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

Why does this keymove not want to function correctly as the script says?

Asked by 7 years ago

Hello everyone, I made a key move and I got all the right things added in the whole script, now this is just a part of the script that doesn't seem to work properly.

When this key is pressed, a whole circle like mesh should keep on growing in size, when I try it in studio it just begins with a little circle and then freezes and doesn't function right.

What is the problem here?

function Zmove()
    print("Finding Operoom")
    if char.Torso:FindFirstChild("OpeRoom") == nil then
    print("Not Found")
    game:GetService("Chat"):Chat(char, "Ope Ope no mi: Room")
    print("Chatted")
    local room = Instance.new("Part", char.Torso)
    room.BrickColor = BrickColor.new("Bright bluish green")
    room.Material = "SmoothPlastic"
    room.Reflectance = 0.7
    room.Transparency = 0.6
    room.Name = "OpeRoom"
    room.Anchored = true
    room.CanCollide = false
    room.Elasticity = 0
    room.Friction = 1
    room.Shape = "Ball"
    room.Size = Vector3.new(1,1,1)
    room.TopSurface = 0
    room.BottomSurface = 0
    room.CFrame = char["Right Arm"].CFrame+Vector3.new(0,-1,0)
    for i = 1, 3 do
        room.Size = room.Size+Vector3.new(10*holdtime,10*holdtime,10*holdtime)
        room.CFrame = char["Right Arm"].CFrame+Vector3.new(0,-1,0)
        run.Stepped:wait()
    end
    local opelight = Instance.new("PointLight")
    opelight.Range = room.Size.Y/2
    opelight.Name = "OpeLight"
    opelight.Parent = room
    area = room.Size.Y
    half1 = Vector3.new(-room.Size.X/2,-room.Size.Y/2,-room.Size.Z/2)
    half2 = Vector3.new(room.Size.X/2,room.Size.Y/2,room.Size.Z/2)
    operoomcframe = room.CFrame
    else
        print("Found")
        game:GetService("Chat"):Chat(char, "Ope Ope no mi: Room Collapse")
        for i = 1, char.Torso.OpeRoom.Size.Y-1 do
            if char.Torso:FindFirstChild("OpeRoom") == nil then debounce = false return end
            char.Torso.OpeRoom.Size = char.Torso.OpeRoom.Size+Vector3.new(-1,-1,-1)
            char.Torso.OpeRoom.CFrame = operoomcframe
            char.Torso.OpeRoom.OpeLight.Range = char.Torso.OpeRoom.Size.Y/2
            run.Stepped:wait()
        end
        area = 0
        half1 = 0
        half2 = 0
        operoomcframe = 0
        char.Torso.OpeRoom:Destroy()
    end
    debounce = false
end

0
You should indent your code correctly. BlueTaslem 18071 — 7y

Answer this question