This Video Is A Tutorial.
Edits By Fotor.
www.fotor.com/photo-editor-ap...
Edits by InShot.
inshotshare.app
Sub Goal: 100 Subs, Come Sub If You Want:
/ @dabeargaming1
Chapters:
00:00 Hi
00:05 Tutorial
01:42 Bye:)
Links:
-Roblox-
Roblox Profile: www.roblox.com/users/44270280...
Roblox Game: www.roblox.com/games/15395389...
-KZitem-
Video Playlist: • Videos
Channel: @DabearGaming1
Script:
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local tweenService = game:GetService("TweenService")
-- Create ScreenGui
local screenGui = Instance.new("ScreenGui")
screenGui.Parent = game.Players.LocalPlayer.PlayerGui -- Parent to PlayerGui
screenGui.IgnoreGuiInset = true -- Ignore GUI inset for mobile devices
-- Create Background Frame for Health Bar
local backgroundFrame = Instance.new("Frame")
backgroundFrame.Size = UDim2.new(0, 200, 0, 20)
backgroundFrame.Position = UDim2.new(0.01, 0, 0.98, 0) -- Move to bottom left corner
backgroundFrame.AnchorPoint = Vector2.new(0, 1) -- Anchor to bottom left
backgroundFrame.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
backgroundFrame.BorderSizePixel = 0
backgroundFrame.Parent = screenGui
-- Create UIStroke for Background Frame
local uiCorner = Instance.new("UICorner")
uiCorner.CornerRadius = UDim.new(0.2,5)
uiCorner.Parent = backgroundFrame
-- Create UIStroke for Background Frame
local uiStroke = Instance.new("UIStroke")
uiStroke.Thickness = 4
uiStroke.Color = Color3.fromRGB(0, 0, 0) -- Black stroke color
uiStroke.Parent = backgroundFrame
-- Create Health Bar Frame
local healthBarFrame = Instance.new("Frame")
healthBarFrame.Size = UDim2.new(humanoid.Health / humanoid.MaxHealth, 0, 1, 0)
healthBarFrame.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
healthBarFrame.BorderSizePixel = 0
healthBarFrame.Parent = backgroundFrame
-- Create UICorner for the Health Bar
local uiCorner = Instance.new("UICorner")
uiCorner.CornerRadius = UDim.new(0.2, 5)
uiCorner.Parent = healthBarFrame
-- Create Health Text
local healthText = Instance.new("TextLabel")
healthText.Size = UDim2.new(0.8, 0, 1, 0) -- Adjusted size to fit text
healthText.Position = UDim2.new(0, 5, 0.5, 0) -- Align to the left with some padding
healthText.AnchorPoint = Vector2.new(0, 0.5) -- Set anchor point to left
healthText.Text = "100/100"
healthText.TextScaled = true
healthText.TextColor3 = Color3.fromRGB(0, 0, 0) -- Black text
healthText.Font = Enum.Font.FredokaOne -- Fredoka One font
healthText.BackgroundTransparency = 1
healthText.Parent = backgroundFrame
-- Function to update health bar
local function updateHealth()
local currentHealth = humanoid.Health
local maxHealth = humanoid.MaxHealth
local healthPercentage = math.round((currentHealth / maxHealth) * 100)
healthText.Text = tostring(currentHealth) .. "/" .. tostring(maxHealth)
local tween = tweenService:Create(healthBarFrame, TweenInfo.new(0.35, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), { Size = UDim2.new(currentHealth / maxHealth, 0, 1, 0) })
tween:Play()
end
-- Connect health update event
humanoid:GetPropertyChangedSignal("Health"):Connect(updateHealth)
humanoid:GetPropertyChangedSignal("MaxHealth"):Connect(updateHealth)
-- Initial call to update health
updateHealth()
Негізгі бет Ойындар How to make a Health Bar Roblox Studio Tutorial
Пікірлер: 6