I think what you are trying to print something to the players screen, the print() function only prints things to your output bar, so the first thing wrong with your script is that it is printing stuff to the wrong area, for instance
print("Hi i'm bob")
would give this to the output bar: Hi i'm bob. Players can't see the output bar unless they use the Developer Console, which can be opened with F9. The print function can also print variables, even variables containing integers!
local zombie101 = 123
print(zombie101)
this would print 123 to your output bar.
The way you would print something to a player's screen, is to create a hint. A hint is a Roblox instance that can contain text. Creating a hint is simple! You just do
local newHint = Instance.new("Hint")
Now we can change the "Text" property of hint using
newHint.Text = "You Win"
Now we need to put the hint in Workspace, so everyone can see your new hint!
newHint.Parent = game.Workspace
Now on to part two of your script! Your function win() does not return a true or false value. It returns nothing at all! That means using print(win()) would do nothing! so the first thing we will do is return true after your function
function Win()
local win = false
local newHint = Instance.new("Hint")
newHint.Text = "You Win"
newHint.Parent = game.Workspace
win = true
return win
end
Next we must discuss the use of true and false, true and false are Boolean values. Meaning they can only be true or false. Certain things do not return Boolean values, such as scripts. If you want to disable a script, you should probably move it to the ServerStorage The ServerStorage is an area of your game where you can store things. In the ServerStorage, scripts don't run, so it technically disables it for you.
local serverStore = game:GetService("ServerStorage")
disaster.Parent = serverStore
Now for your finished product!
local humanoid = workspace:FindFirstChild("Zombie").Humanoid
local disaster = workspace:FindFirstChild ("Disaster Script")
local serverStore = game:GetService("ServerStorage")
function Win()
local win = false
local newHint = Instance.new("Hint")
newHint.Text = "You Win"
newHint.Parent = game.Workspace
win = true
return win
end
if humanoid.Health == 0 then
print (Win())
if Win() == true then
disaster.Parent = serverStore
end
end
2 comments
I'm not saying this is a bad answer, because this is a great answer. But it might be worth noting that Hints are deprecated. http://wiki.roblox.com/index.php?title=API:Class/Hint
Oh, well I guess that makes me a hipster. What is the new hint anyways?