I have 2 scripts. One of them runs a custom Health GUI and the other one equips a random limited accessory when you type “/e equip avatar” on the chat (cause why not ッ)
Custum Health GUI
My script:
script.Parent.Visible = true
local playerName = script.Parent.Parent.Parent.Parent.Parent.Name -- I WILL CHANGE THIS LATER TO LOCALPLAYER!!
local healthBar = script.Parent.healthBar
local player = game.Workspace:WaitForChild(playerName)
local healthlabel = script.Parent.healthlabel
while true do -- I WILL ALSO CHANGE THIS LATER!!!
local hum = player:WaitForChild("Humanoid")
local health = hum.Health
wait(0.1)
healthlabel.Text = health
healthBar.Size = UDim2.new(0,health,0,18)
if health <50 then
--print("health below 50")
healthBar.BackgroundColor3 = Color3.new(1, 1, 0)
end
if health <25 then
healthBar.BackgroundColor3 = Color3.new(1, 0, 0)
end
if health >50 then
healthBar.BackgroundColor3 = Color3.new(0.333333, 1, 0)
end
end
What I wanted it to do is to count my Health on my Humanoid.
What It actually does:
It is stuck on 100 health on the GUI and resetting said GUI will put the health down to 0 but character never dies
/e equip avatar script
The script:
local Accessories = game.ServerStorage.e_equip_avatar_cmd:GetChildren()
local Folder = game.ServerStorage.e_equip_avatar_cmd
game.Players.PlayerAdded:Connect(function(p)
p.Chatted:Connect(function(plr)
local name = p.Name
if plr:lower() == "/e equip avatar" then
print("lol this person actually said /e equip avatar")
local target = game.Workspace:FindFirstChild(name)
if target then
if target:FindFirstChild("temp") then
target:FindFirstChild("temp"):Destroy() -- destroyed prev accessory
end
local chosen = Accessories[math.random(1,6)]
if chosen then
local Accessory = Folder:FindFirstChild(chosen.Name):Clone()
warn("Accessory "..chosen.Name.." Copied to "..name)
Accessory.Name = "temp"
Accessory.Parent = target
target.Humanoid:AddAccessory(Accessory) -- I even tried to use this
else
error("unable to fetch Accesorry. Try again later")
return false -- Probably these are redundant after error()
end
else
error("Target not found.")
return false -- same here
end
end
end)
end)
warn("hello. i dare you to type in /e equip avatar in the game chat >:)")
What it is suppose to do:
Equips a accessory after player chatted “/e equip avatar”
What is actually does:
Does absolutely nothing even with :addAccessory()
on the script
NOTE: I noticed that the Void Star did load in obn the video but the rest is not loading!
It seems like they all stop working after a roblox update. I swear they were working before untill now!