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

My intvalue if statement is not working correctly?

Asked by 3 years ago
Edited 3 years ago

So im trying to make a FNaF movement but with a flash mechanic which makes the character go 1 step back

I have a IntValue for the position, after the script sleeps for some random time generated, the IntValue increments by 1, the script that moves the model and does all that visual n sound effect things, will just execute when the IntValue is incremented

In resume: I have the intvalue incremented by 1 so the character moves 1 step forward the player uses the flash mechanic and the intvalue decrements by 1, but when that is made, the character will not move 1 step back

the script is a basic one but it should, on my believings work

Value.Changed:Connect(function()
    if Value.Value == 1 then
        model:SetPrimaryPartCFrame(position1)
    end
    if Value.Value == 2 then
        model:SetPrimaryPartCFrame(position2)
    end
    if Value.Value == 3 then
        model:SetPrimaryPartCFrame(position3)
    end
end)

i have those variables defined, it is just a how it looks like.

Any idea to whats wrong??

0
SetPrimaryPartCFrame()* not lowercase s greatneil80 2647 — 3y
0
I know, made a mistake there back7776 4 — 3y

1 answer

Log in to vote
0
Answered by
4jnx 50
3 years ago

Hey there! So I think what's happening is when your setting it back for E.G from 3 to 2 when checking what value the intvalue is when your setting the primarypartcframe position the position that is being changed is still the position that makes the character go forward.

Not sure if that made sense but hopefully it did!

Ad

Answer this question