i was scripting screenGui script that tracks speed by frames background color changing from white to yellow
and i dont think just copy paste if then elseif will be efficent way to make it
here is script
local Player = game:GetService("Players").LocalPlayer
local character = Player.Character or Player.CharacterAdded:Wait()
local humanoid = character:FindFirstChildOfClass("Humanoid")
local Gui = script.Parent
local SpeedGui = {
Gui.P1,
Gui.P2,
Gui.P3,
Gui.P4,
Gui.P5
}
humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(function()
local Speed = humanoid.WalkSpeed
if Speed >= 20 then
SpeedGui[1].BackgroundColor3 = Color3.fromRGB(255, 170, 0)
else
SpeedGui[1].BackgroundColor3 = Color3.fromRGB(255, 255, 255)
end
end)
at very least it does detects if it reached that speed and does changes color from white to yellow and vice versa when speed is lower than needed
here what i came up
for i, v in pairs(SpeedGui) do
if Speed >= 20 + (i * 5) then
v.BackgroundColor3 = yellow
else
v.BackgroundColor3 = white
end
end
(dont bother about yellow or white i just shortened it)