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

my script doesnt wark after an if statement that is supposed to be right?

Asked by 7 years ago

this script is inside a tool/ card the tool also has a value if the tool touches the door/(a part thats invisible inside the door model) if the value is true then

the door is supposed to lerp (im gonna script that later), i set the print(hello,4,3,2,1) there to see if it gets trough the if statements wich it doesnt for some reason it only prints the 'hello4'( the first one )

is there someone that can explain this to me ?

Note: if you have any questions or need more information i can react for 4 more hours i'll check every 10-15 mins

True = script.Parent.True
card = script.Parent.Handle

---

card.Touched:connect(function(otherPart)
    print('hello4')
    if otherPart.Name == 'Touch,Color1,Color2' then
        print('hello3')
        if otherPart.Parent.Name == 'DoorLerp, Card, CardT' then
            print('hello2')
            if True == true then
                local DoorL = otherPart.Parent
                local D1 = DoorL.Door1
                local D2 = DoorL.Door2
                local C1 = DoorL.Color1
                local C2 = DoorL.Color2
                local D1mPos = D1.Position
                local D1To = Vector3.new(-96.66, 4, -29.219)
                local D2mPos = D2.Position
                local D2To = Vector3.new(-96.76, 4, -35.068)

                ---
                print('hello')
                for ratio = 0,1,0.01 do

                end
            end
        end
    end
end)
0
For line 8, are you trying to check if the part's name is either of those? And for line 12, you're checking if the object is true - which will error b/c if it isn't there - and I can only assume you're using a BooleanValue object; you need to check if its property is true. (BooleanValue.Value = Boolean) TheeDeathCaster 2368 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
True = script.Parent.True
card = script.Parent.Handle

---

card.Touched:connect(function(otherPart)
    print('hello4')
    if otherPart.Name == 'Touch' or otherPart.Name == 'Color1' or otherPart.Name == ' 'Color2' then --This might be how it should go, but im not sure, you can always revert
        print('hello3')
        if otherPart.Parent.Name == 'DoorLerp' or otherPart.Parent.Name == 'Card ' or otherPart.Parent.Name == 'CardT' then --This might be how it should go, but im not sure, you can always revert
            print('hello2')
            if True.Value == true then --It should be  True.Value
                local DoorL = otherPart.Parent
                local D1 = DoorL.Door1
                local D2 = DoorL.Door2
                local C1 = DoorL.Color1
                local C2 = DoorL.Color2
                local D1mPos = D1.Position
                local D1To = Vector3.new(-96.66, 4, -29.219)
                local D2mPos = D2.Position
                local D2To = Vector3.new(-96.76, 4, -35.068)

                ---
                print('hello')
                for ratio = 0,1,0.01 do

                end
            end
        end
    end
end)

0
Thank you ive been stuck with this for the last few hours TigerClaws454 48 — 7y
Ad

Answer this question