Im trying to make a script that will activate certain commands once a model is gone. It works when I test the game without the model to begin with, but when I test the game with the model and then remove it, the script wont activate the commands. Correct me if I'm wrong, but I think its because it only checks to see if the model is there or not one time in the beginning.
So I want to know how to code it to make it constantly check if it's there or not.
local disaster = workspace:FindFirstChild ("Disaster Script") local humanoid = workspace:FindFirstChild("Soldier") local serverStore = game:GetService("ServerStorage") function Win() m = Instance.new("Hint") m.Parent = game.Workspace m.Text = "You Win! [Restarting...]" wait(5) m:Remove() end if humanoid == nil then disaster.Parent = serverStore print (Win()) wait () disaster.Parent = workspace end
Make them a function, example:
function humanoid() return workspace:findFirstChild('Soldier') end
It will check whenever you call it.
Or maybe make use of coroutines(+ loops) to update values in another thread(in another "routine").
http://wiki.roblox.com/index.php/Beginners_Guide_to_Coroutines