Hi So i have this gui called power level and i have a tool you are given when you press f how can i make it so that when your bar(Power Level) fills up it only then will give you the tools when you press a certain keybind
It’s just as you explained it. Let me give you a pseudocode that might help you out when you code:
Connect Function to f keybind
if power level is full then
power level = 0
Reset power level gui
Remove tool from player backpack
Give player new tool to use
end
end
is it ok if i send you copy of game so you can better see the code
I’m not exactly sure how that would help in this situation, but you just need to convert these pseudocode (generally coding language in English) into Lua
Don’t people watching this can steal them, send the gui as a rbxm or a model.
so i have a script for this weapon on key f pressed in puts it into your tool bar i have 2 gui images one red one black i want it to start black but then the red slowly covers the black like a bar filling up and when it reaches the end i want a text box to pop on showing the f key in brackets i want it so the player can ONLY get it when bar is full not just from pressing f anytime
first how can i make a script that makes bar go down
i have started to make a script does this look good so far
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 == "Health" 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.WalkSpeed = SprintSpeed
end
end
end)
UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.LeftShift then
Running = false
Character.Humanoid.WalkSpeed = WalkSpeed
end
end
end)
while true do
if not Running and Stamina < 100 then
Stamina = math.min(Stamina + 0.5, 100)
StaminaBar:TweenSize(UDim2.new(Stamina / 100, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.1, true)
end
wait(0.1)
print(Stamina, StaminaBar.Size)
end