GUI Text label is not updating

I have a GUI for a cooldown on a weapon skill.

It will only update the text if I unequip and re-equip the weapon.

weaponcontrol

for i = 1, 7 do
			script.ScreenGui.Frame.S2.Text = 8-i
			task.wait(1)
		end
		script.ScreenGui.Frame.S2.Text = "SKILL-2"

Could we see the whole script? Where are you actually facing this for loop in?

1 Like
game:GetService("UserInputService").InputBegan:Connect(function(input, IsTyping, damage, hitboxTime)
	if input.KeyCode == Enum.KeyCode.E and dB == false and currentlyAttacking == false  and equipped == true and not IsTyping then
		currentlyAttacking = true
		dB = true
		
		local anim = Instance.new("Animation")
		anim.AnimationId = "https://www.roblox.com/Assest?ID=14391728032"
		local track
		track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
		track.Priority = Enum.AnimationPriority.Action2
		track:Play()
		track:AdjustSpeed(1)

		damage = 25
		input = "Special"
		hitboxTime = .7
		remote:FireServer(input, IsTyping, damage, hitboxTime)
		
		task.wait(1)
		currentlyAttacking = false
		for i = 1, 7 do
			script.ScreenGui.Frame.S2.Text = 8-i
			task.wait(1)
		end
		script.ScreenGui.Frame.S2.Text = "SKILL-2"
		dB = false
	end
end)

local Ui = script:WaitForChild("ScreenGui") -- Your Gui Name Here

script.Parent.Equipped:Connect(function()
	local ScreenGui = Ui:Clone()
	ScreenGui.Parent = game.Players.LocalPlayer.PlayerGui
end)

script.Parent.Unequipped:Connect(function()
	game.Players.LocalPlayer.PlayerGui:FindFirstChild(Ui.Name):Destroy()
end)

Everything is in AttackControl (Local Script)

It’s because you’re not changing the text on the instance that is in the player GUI, you’re changing it on the template that’s getting cloned

I have created a monster, the GUI will constantly be destroyed and cloned to feign live changes.

1 Like

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