Why isn't this script working?

Trying to make a cool inventory system, something is getting in my way. no output errors. it just doesn’t work.

local inv = script.Parent.ScreenGui.Inv
local player = game.Players.LocalPlayer
game.UserInputService.InputEnded:Connect(function(key, gameProcessedEvent)
	if not gameProcessedEvent and (key == Enum.KeyCode.E or key == Enum.KeyCode.ButtonB) and enabled == true then
		if inv.Visible == false then
			inv.Visible = true
			enabled = false
			inv.On:Play()
			player.Character:FindFirstChild("Humanoid").WalkSpeed = 0
			inv.Frame.Position = UDim2.new(0.5,0,0.3,0)
			game.TweenService:Create(inv,TweenInfo.new(.25,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{Position = UDim2.new(0.5,0,0.5,0)}):Play()
			inv.Static.Visible = true
			wait(.1)
			inv.Static.Visible = false
			wait(.05)
			inv.Static.Visible = true
			enabled = true
			elseif inv.Visible == true then
				inv.Visible = false
			inv.Off:Play()
			enabled = false
			player.Character:FindFirstChild("Humanoid").WalkSpeed = 16
				inv.Static.Visible = false
				enabled = true
		end
	end
end)```

Can you clarify what does’nt works?

The script isnt running at all, no errors or outputs

Replace this line with:

if not gameProcessedEvent and (key.KeyCode == Enum.KeyCode.E or key.KeyCode == Enum.KeyCode.ButtonB) and enabled == true then

Thank you, can’t believe i overlooked this

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.