You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
i want to detect that the child added in a folder so i add a health bar to it
- What is the issue? Include screenshots / videos if possible!
it dosent work
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i tried many solutions on Dev Hub
i tried debugging and printing but it didnt do anything i feel like the child added isnt even firing
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Script (Not Done)
local MobModule = require(script.Mobs)
local SpawnBalloon = game.ReplicatedStorage:WaitForChild("SpawnBalloon")
local SpawnTower = game.ReplicatedStorage:WaitForChild("AddTower")
local Information = game.ReplicatedStorage:WaitForChild("MainGame"):WaitForChild("Information")
local GameStarted = game.ReplicatedStorage:WaitForChild("MainGame"):WaitForChild("GameStarted")
local Rounds = game.ReplicatedStorage:WaitForChild("MainGame"):WaitForChild("Rounds")
local OpenGui = game.ReplicatedStorage:WaitForChild("OpenGui")
local StartingCash = 100
local function GiveCash(Player, Amount)
Player.PlayerData.Cash.Value = Player.PlayerData.Cash.Value + Amount
end
local function SetHealth(Char)
local Hum = Char.Humanoid
local GuiClone = game.ReplicatedStorage.HealthGui:Clone()
GuiClone.Parent = Char
--// Scripting HealthBar \\--
local colorGreen = Color3.fromRGB(0, 255, 0)
local colorRed = Color3.fromRGB(255, 0, 0)
while wait() do
local Health = Hum.Health
local MaxHwalth = Hum.MaxHealth
local Percentage = Health / MaxHwalth
GuiClone.TextLabel.Text = GuiClone.Parent.Name..": "..Health.."/"..MaxHwalth
GuiClone.Health.Size = UDim2.new(Percentage, 0, 1 ,0)
GuiClone.Health.BackgroundColor3 = colorRed:Lerp(colorGreen, Health / MaxHwalth)
end
end
for i = 10,0,-1 do
Information.Value = "Game Starting In "..i
wait(1)
if i == 0 then
local RandomPlayer = game:GetService("Players"):GetChildren()[math.random(1,#game:GetService("Players"):GetChildren())]
print(RandomPlayer.Name)
for i, v in pairs(game.Players:GetPlayers()) do
GiveCash(v, StartingCash)
if v.Name == RandomPlayer.Name then
v.PlayerData.IsImposter.Value = true
OpenGui:FireClient(v, v.PlayerGui.TowerGui)
else
OpenGui:FireClient(v, v.PlayerGui.BalloonGui)
end
end
print("Finished with Players")
GameStarted.Value = true
coroutine.wrap(SetHealth)(workspace.Base)
SpawnBalloon.OnServerEvent:Connect(function(Player, BalloonName)
MobModule.Spawm(BalloonName)
end)
while wait(.25) do
MobModule.Spawm("PinkBalloon")
end
workspace.Balloons.ChildAdded:Connect(function(Object)
print("Object Spawned: ".. Object.Name)
coroutine.wrap(SetHealth)(Object)
end)
end
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.