RipliNoir
(RipliNoir)
September 28, 2023, 8:50am
#1
Hello everyone!
I take public script from dev forum, and this script make custom playertag and healthbar.
BUT, this script working only studio, in game dont working:
Script:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RS = game:GetService("RunService")
local player = Players:GetPlayerFromCharacter(script.Parent)
local playerTag = ReplicatedStorage:WaitForChild("PlayerTag"):Clone()
local nameTag = playerTag:WaitForChild("Name")
local healthBar = playerTag:WaitForChild("Healthbar")
local humanoid = script.Parent:WaitForChild("Humanoid")
humanoid.NameDisplayDistance = 0
humanoid.HealthDisplayDistance = 0
playerTag.Parent = script.Parent
playerTag.Adornee = script.Parent:WaitForChild("Head")
nameTag.Text = player.Name
healthBar.BackgroundColor3 = Color3.new(0.505882, 0.772549, 0.0862745)
local function updateHealthBar()
local playerHealth = humanoid.Health
local healthBarColor3 = Color3.new(0.505882 - (playerHealth / humanoid.MaxHealth), (playerHealth / humanoid.MaxHealth), 0.0862745)
healthBar.Size = UDim2.new(playerHealth / humanoid.MaxHealth, 0, 0.3, 0)
healthBar.BackgroundColor3 = healthBarColor3
end
RS:BindToRenderStep("updateHealthBar", 301, updateHealthBar)
Have a nice day!
It’s more than likely RunService. I’ve experienced RunService acting way different in Studio than on the actual game. I don’t really know the exact reason as to why it acts differently, but I would recommend changing the updateHeatlhBar function to when the player actually takes damage, not with RunService. Let me know if this helps.
os_clock
(os_clock)
September 28, 2023, 7:55pm
#3
Try this:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RS = game:GetService("RunService")
local player = Players:GetPlayerFromCharacter(script.Parent)
local playerTag = ReplicatedStorage:WaitForChild("PlayerTag"):Clone()
local nameTag = playerTag:WaitForChild("Name")
local healthBar = playerTag:WaitForChild("Healthbar")
local humanoid = script.Parent:WaitForChild("Humanoid")
humanoid.NameDisplayDistance = 0
humanoid.HealthDisplayDistance = 0
playerTag.Parent = script.Parent
playerTag.Adornee = script.Parent:WaitForChild("Head")
nameTag.Text = player.Name
healthBar.BackgroundColor3 = Color3.new(0.505882, 0.772549, 0.0862745)
local function updateHealthBar()
local playerHealth = humanoid.Health
local healthBarColor3 = Color3.new(0.505882 - (playerHealth / humanoid.MaxHealth), (playerHealth / humanoid.MaxHealth), 0.0862745)
healthBar.Size = UDim2.new(playerHealth / humanoid.MaxHealth, 0, 0.3, 0)
healthBar.BackgroundColor3 = healthBarColor3
end
humanoid:GetPropertyChangedSignal("Health"):Connect(function()
updateHealthBar()
end)
1 Like
system
(system)
Closed
October 12, 2023, 7:55pm
#4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.