I can't open a gui

  1. I want when i activate the tool its should open a gui and the bar will tween but its not working ;-;

  2. What is the issue?


    robloxapp-20200429-1713069.wmv (2.0 MB)

  3. What solutions have you tried so far? I tried to change the starter gui to the player gui but it doesnot work.

Here are the place of this script:

The script is a local script and its on The Iphone 6 Tool.

The Script in Text:

script.Parent.Activated:Connect(function()
	local plr = game.Players.LocalPlayer
	local BagValue = game.Players.LocalPlayer:WaitForChild('Backpack').BagMultiplier
	local backpack = plr:WaitForChild('Backpack')
	local waittime = backpack.WaitTime 
	local MaxBag = game.Players.LocalPlayer.Backpack.MaxBag
	local Bag = game.Players.LocalPlayer:WaitForChild('leaderstats'):FindFirstChild('GB')
	local gui = plr:WaitForChild('PlayerGui').HackBar
	local debounce = false
	if MaxBag.Value > Bag.Value then
	if debounce == false then
		debounce = true
		gui.Enabled = true
		gui.bar:TweenSize(UDim2.new(0.231, 0,0.031, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Bounce,waittime.Value,false,nil)
		Bag.Value = Bag.Value + BagValue.Value
		gui.Enabled = false
		gui.bar.Size = UDim2.new(0.002, 0,0.031, 0)
		debounce = false
		print(tostring(debounce))
		end
	else
			print('Player bag is full')
	end
end)
-- Show Size {0.231, 0},{0.031, 0}
-- Hide Size {0.002, 0},{0.031, 0}


Thanks, :smile:

1 Like

Tweens don’t yield. You’re changing the gui to enabled and tweening the size but almost instantaneously reverting them. The last parameter will call the given function when the tween is complete (or you can just wait() the duration). Also, why is your debounce variable within the function? It’ll always be false when the functions runs.

2 Likes

Thanks a lot, thats why my debouce was always set to false :slight_smile: