Will This Script Work

Hi So i have this gui you will notice a red and black bar i have them seperate just for a visual so i want the black bar to show and i want the red abr to slowly fill up the blackbar over time i will show you the gui i made this for
Screenshot 2023-09-01 131709

I have started a script (dont make fun of me i am very bad at scripting) i dont know how to get it to work like i explained above

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local UserInputService = game:GetService("UserInputService")

local PowerLevel = 100

local PowerLevel = script.Parent.Frame

PowerLevel.Size = UDim2.new(1, 0, 1, 0)
Character:WaitForChild("Humanoid").Changed:Connect(function(property)
	if property == "PowerLevel" then
		PowerLevel.Size = UDim2.new(Character.Humanoid.PowerLevel / 100, 0, 1, 0)
	end
end)

UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
	if not gameProcessedEvent then
		if input.KeyCode == Enum.KeyCode.R then
		    
			Character.Humanoid.Powerlevel = PowerLevel
		end
	end
end)

UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
	if not gameProcessedEvent then
		if input.KeyCode == Enum.KeyCode.R then
		    local ReplicatedStorage:FindFirstChild = "Serious"
			Character.Humanoid.PowerLevel = PowerLevel
		end
	end
end)


while true do
	if not PowerLevel and PowerLevel < 100 then
		PowerLevel = math.min(PowerLevel + 0.5, 100)
		PowerLevel:TweenSize(UDim2.new(PowerLevel / 100, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.1, true)
	end
	wait(0.1) 
	print(PowerLevel, PowerLevel.Size)
end
2 Likes

Move your topic to " Code Review " category instead of " Scripting Support " so that people know what you’re exactly asking for help about. And before your post gets taken down.

1 Like

well im asking why its not working because i dont get it

1 Like

People in " Scripting Support " help you implement a specific system or something similar. They don’t review your code.

That’s why you should move your topic to " Code Review " and people there will help you.

1 Like

ok thank you charachter limit.

1 Like

No problem!

Also, people in Code Review aren’t as many as people in Scripting Support, but they’ll help you. Just be patient. It can take several hours.

2 Likes

ok alr char limittttttttttttttttttttttttttttttttt

3 Likes

If the code doesn’t work, then they should put it in #help-and-feedback:scripting-support instead of #help-and-feedback:code-review. Code Review is for scripts that already work but might need revisions or feedback of some kind.

1 Like

Oh okay. Didn’t know that.

Thank you!

1 Like