Help to make barricade system🛠️

so that players could repair the barricade and break the zombies, otherwise I constantly have errors

1 Like

Do you want a complete Barricade system or just a Health system for it?

Health System, i tried create it with value but its dont working

What kind of script you made so far?

local prompt = script.Parent:WaitForChild("ProximityPrompt")
local barricadeModel = workspace:WaitForChild("Barricade")
local totalHP = 0
local hpPerBarricade = 15
local maxBarricades = #barricadeModel:GetChildren()
local currentBarricadeIndex = 0
local function activateNextBarricade()
	currentBarricadeIndex += 1
	if currentBarricadeIndex <= maxBarricades then
		local barricade = barricadeModel:GetChildren()[currentBarricadeIndex]
		if barricade:IsA("BasePart") then
			barricade.Transparency = 0
			barricade.CanCollide = true
		elseif barricade:IsA("Model") then
			for _, part in ipairs(barricade:GetDescendants()) do
				if part:IsA("BasePart") then
					part.Transparency = 0
					part.CanCollide = true
				end
			end
		end
	end
end
prompt.Triggered:Connect(function(player)
	totalHP += 10
	print("Build HP: ", totalHP)
	local expectedBarricades = math.floor(totalHP / hpPerBarricade)
	while currentBarricadeIndex < expectedBarricades and currentBarricadeIndex < maxBarricades do
		activateNextBarricade()
	end
end)

1 Like

You’re running the Script here as a LocalScript, which is likely why it’s not working. Incase you render your Zombies on the Server side, what you do on the Client side won’t replicate to the Server side.

2 Likes

Worked lol thx, but can you help me do pathfindingnpc🐟, cuz guide from roblox is incomprehensible


sorry for long answer, my wifi is suck

make a different topic for that i guess

1 Like

fine good luck :> I forgot that the local script only works for the player

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.