Roact Binding not working

  1. What do you want to achieve?
    Tweening with Roact.

  2. What is the issue?
    I keep getting the error: attempt to index nil with 'map'

  3. What solutions have you tried so far?
    Nothing has helped. I am clueless on my its happening.

Please help me. I am still confused on this.

I’m no roact expert, but you should try to post your code? Solving a problem with no code is very hard to do, I’m sure some person more experienced in roact would be glad to help if you did this.

Give me a few minutes. Visual Studio Code keeps crashing.

Here is what the binding binds to:

Roact.createElement("Frame", {

                Name = "HomePage",

                Active = true,

                BackgroundColor3 = Color3.fromRGB(255, 255, 255),

                BackgroundTransparency = 1,

                Size = UDim2.new(1, 0, 1, 0),

                Position = self.homePageBinding:map(function(value)

                    return UDim2.new(0,0,0,0):Lerp(UDim2.new(-5, 0, 0, 0), value)

                end)

            }

And here is the code that creates and configures the binding:

function Main:init()

    self.homeButtonRef = Roact.createRef()

    self.homePageMotor = Flipper.SingleMotor.new(0)

    local homePageBinding, setHomePageBinding = Roact.createBinding(self.homePageMotor:getValue())

    self.homePageBinding = homePageBinding

    self.homePageMotor:onStep(setHomePageBinding)

end
1 Like