Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Script can't go past line 12?

It stops when it hits... if pos.Value == "0" then on line 12.. I know it's correct but it doesn't go through.. No errors or anything like that.

GUI = script.Parent
Player = game.Players.LocalPlayer
mouse = Player:GetMouse()
pos = script.Parent.Pos
debounce = true

function keydown(key)
	print(key)
	key = key:lower()
	print(key)
	if key == "q" then
		if pos.Value == "0" then
			if debounce == true then
				print(debounce)
				debounce = false
				print(debounce)
				GUI:TweenPosition(UDim2.new(1, -100, 1, -100), "Out", "Elastic")
				pos.Value = "1"
			else
				GUI:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Elastic")
				pos.Value = "0"
				print(debounce)
			end
			debounce = true
		end
	end
end

mouse.KeyDown:connect(keydown)

1 answer

✓ Accepted answer

If pos is an integer value then you don't need to include the quotation marks around the number. pos.Value == "1" is pretty much asking if the value of pos is a string 1 not a number 1. You would use pos.Value == 1 to check to see if it's equal to 1. I have fixed it for you.

GUI = script.Parent
Player = game.Players.LocalPlayer
mouse = Player:GetMouse()
pos = script.Parent.Pos
debounce = true

function keydown(key)
    print(key)
    key = key:lower()
    print(key)
    if key == "q" then
        if pos.Value == 0 then
            if debounce == true then
                print(debounce)
                debounce = false
                print(debounce)
                GUI:TweenPosition(UDim2.new(1, -100, 1, -100), "Out", "Elastic")
                pos.Value = 1
            else
                GUI:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Elastic")
                pos.Value = 0
                print(debounce)
            end
            debounce = true
        end
    end
end

mouse.KeyDown:connect(keydown)

1 comment

0

LOL, opps. I was quite tired when I was coding this... I didn't realize that I did that.

This discussion is preserved as it was. New answers, comments, and votes are closed.