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

Why doesnt this script change the positions to desired!?

Asked by 5 years ago
Edited 5 years ago
local StartingQuestion = script.Parent.Parent.Parent.EXQUESTION1
local Button = script.Parent
local PosAnswer1 = StartingQuestion.One
local PosAnswer2 = StartingQuestion.Two
local PosAnswer3 = StartingQuestion.Three
local PosAnswer4 = StartingQuestion.Four
local pos1 = PosAnswer1.Position
local pos2 = PosAnswer2.Position
local pos3 = PosAnswer3.Position
local pos4 = PosAnswer4.Position
Button.MouseButton1Click:Connect(function()

    local position = math.random(1,2)

    if position == 1 then
        StartingQuestion.Visible = true
        Button.Visible = false
    end

    if position == 2 then
        PosAnswer1.Position = UDim2.new(pos2)
        PosAnswer2.Position = UDim2.new(pos3)
        PosAnswer3.Position = UDim2.new(pos4)
        PosAnswer4.Position = UDim2.new(pos1)
        print("Macro Protection")
        StartingQuestion.Visible = true
        Button.Visible = false
    end

end)

if position 2 (statement) does not change the PosAnswer positions to the desired, instead it changes them all to the position of 0!

1
Hmm, it may be because of on line 20, you're just making another if, you should probably change it to elseif position == 2 then ||| Sorry if this is not right, I just woke up xD. TheOnlySmarts 233 — 5y
0
Math.Random() uses ends to find the number tightanfall 110 — 5y

Answer this question