So i’m making a game that has pretty much the same concept as the game criminality and i’m doing pretty good progress but i’m stuck at this :
I wanna make a health gui and stamina bar like this : FIGHTING Jugg And His GANG in Criminality Roblox - YouTube
as you can see the health bar slides smoothly and there is even a gui that shows parts damaged and the stamina bar is similar to the health bar but it detects when the player is running or jumping etc…
I’ve searched for a long time but didn’t find anything, Could anyone help?
And thanks in advance
The method you could use is to insert values like StringValues inside of the damaged parts and them make a while loop with a for loop that goes through the characters part and check if they have the damage value inside of them.
Example:
local player = game.Players.LocalPlayer
while wait(0.5) do
for i, v in pairs(player.Character:GetDescendants()) do
if v:IsA("StringValue") and v.Name == "DamageValue" then
local parent = v.Parent
--do other stuff here
end
end
end
I have another question if you see on the video that i showed you previously both health and body parts gui changes colors like green when it’s good, dark green when it a little bad and red when it’s really bad , and if you go further in the video you notice that :
the part that is damaged like a lot starts flashing so it’s becoming black then red again then black etc…
How can i make both effects?
For a smooth gui color change effect i suggest to use TweenService and use an IntValue so you can set a determinate amount of damage so the script can check if it is up to 0.5 it will be orange, 1 red, etc.
local player = game.Players.LocalPlayer
while wait(0.5) do
for i, v in pairs(player.Character:GetDescendants()) do
if v:IsA("NumberValue") and v.Name == "DamageValue" then
if v.Value > 0 and v.Value <= 0.5 then
--Set color to orange
elseif v.Value >= 0.6 and v.Value <= 1 then
--SetColor to red
end
end
end
end
Also use NumberValue so you can set decimal numbers.
Yep, use the 1st argument that was passed through a Touched event.
local Players = game:GetService('Players')
part.Touched:Connect(function(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent)
if not player then return end
print(hit.Name)
end)