Sup guys, during the development of the tower defense game, I came across a strange error when I want to take away the health of the base because a zombie pops up an error heres an error:
local ServerStorage = game:GetService("ServerStorage")
local bindables = ServerStorage:WaitForChild("Bindables")
local Update = bindables:WaitForChild("UpdataBaseHealth")
local GameOver = bindables:WaitForChild("GameOver")
local base = {}
function base.Setup(map, health)
base.Model = map:WaitForChild("End")
base.CurrentHealth = health
base.MaxHealth = health
base.updateHealth()
end
function base.updateHealth(damage)
if damage then
base.CurrentHealth -= damage
end
local gui = game.StarterGui.Base
local percent = base.CurrentHealth / base.MaxHealth
gui.Back.Health.Size = UDim2.new(percent, 0, 1, 0)
gui["HP text"].Text = base.CurrentHealth.." / "..base.MaxHealth.." HP"
end
Update.OnServerEvent:Connect(base.updateHealth)
return base
and
function mob.Move(mob, map)
local humanoidrp = mob:WaitForChild("HumanoidRootPart")
local humanoid = mob:WaitForChild("Humanoid")
local waypoints = map.WayPoints
for waypoint = 1, #waypoints:GetChildren() do
humanoid:MoveTo(waypoints[waypoint].Position)
humanoid.MoveToFinished:Wait()
end
mob:Destroy()
Update:FireServer(humanoid.Health)
end
Well, I thought that needs to change FireServer to FireAllClients and this ll remove the error, but this was another error, so what ll i do?
Hope u ll help