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

Gui Local Script Not Working For Some Reason That Is Beyond My Ability?

local UserInputService = game:GetService("UserInputService")
local Player = game:GetService("Players").LocalPlayer

UserInputService.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.E then
		if script.Parent.Visible == false then
			script.Parent.Visible = true
			script.Parent:TweenPosition(
				UDim2.new(0,0,0.487), -- end position {0, 0},{0.487, 0}
				"Out", -- easing direction
				"Quart", -- easing style
				2,	-- time
				false, -- override?
				nil -- other stuff
			)
		end
		if script.Parent.Visible == true then
			script.Parent:TweenPosition(
				UDim2.new(0,0,0), -- end position {0, 0},{0.487, 0}
				"Out", -- easing direction
				"Quart", -- easing style
				2,	-- time
				false, -- override?
				nil -- other stuff
			)
			script.Parent.Visible = false
		end
    end
end)

i sad, please help.

3 comments

0

what does the error say in the output?

0

Udim2 needs 4 zeroes, not three. First two are x scale and offset and the other two are y scale and offset.

0

also u should use elseif on line 17 plus answer of radiant_Light203

1 answer

✓ Accepted answer

This is foolish this script i'll have to rewrite a script for this poopy fart btw get these fake scripters out of here trying to help people when they know nothing about lua.

local UserInputService = game:GetService("UserInputService")

local Player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()

local Open = false

UserInputService.InputBegan:Connect(function(Input, IsTyping)
	
	if not IsTyping and Input.KeyCode == Enum.KeyCode.E then
		
		if Open == false then
			
			script.Parent.Visible = true
			
			script.Parent:TweenPosition(UDim2.new(.741, 0,0.394, 0), "Out", "Quart", 2, false, nil)
			
			wait(2)
			
			Open = true
			
		elseif Open == true then
			
			script.Parent:TweenPosition(UDim2.new(0.013, 0,0.387, 0), "Out", "Quart", 2, false, nil)		
			
			wait(2)
			
			script.Parent.Visible = false
			
			Open = false
			
		end			
		
	end
	
end)

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