It's supposed to reset the owner of the "tycoon" pathing map for my ele td game when his Life.Value == 0
just so it's clearer for you, Life = game.Players."Player".leaderstats.Life
Player being of course whoever is playing the game.
function Check(Td,Player)
local LTd = Td
local OTd = Td:Clone()
Player.leaderstats.Life.Changed:connect(function(p)
if LTd.Owner.Value ~= p then
if Player.leaderstats.Life.Value == 0 then
Player.Character.Humanoid.Health = 0
wait(1)
LTd:Remove()
OTd.Parent = workspace
Check(OTd)
end
end
end)
end
function search(obj)
if obj.Name == "Owner" and obj.className == "ObjectValue" then
Check(obj.Parent,obj.Value)
end
for i, v in pairs(obj:GetChildren()) do
search(v);
end
end
search(workspace);
it kept giving me this error:
Sat Apr 17 10:47:46 2010 - Running Script 'Script'
Sat Apr 17 10:47:46 2010 - Player is not a valid member of Players
Sat Apr 17 10:47:46 2010 - Workspace.Script, line 4 - global Check Workspace.Script, line 19 - global search Workspace.Script, line 22 - global search Workspace.Script, line 22 - global search Workspace.Script, line 25 stack end |