Remove the statement in line 2, as it is not used and I doubt you could assign variables to an object's property; only it's value(s).
On line 20, you destroyed your message. You can't edit the text within it if you destroyed it.
If you want to destroy your message, yet still want a message after it is destroyed, remove the existing message and create another function to make a new one just like you did with 'Hint'.
function Hint()
local hint = Instance.new("Hint", game.Workspace)
hint.Text="Game in progress..."
end
function Message()
msg = Instance.new("Message", game.Workspace)
end
while true do
Message()
msg.Text = "Loading."
wait(4)
msg.Text="Starting new game"
wait(3)
msg.Text="Murderer Mode: '1 life Murderer' is chosen."
wait(2)
msg.Text="Everyone is murderer, Good Luck!"
wait(3)
msg:Destroy()
Hint()
wait(120)
Hint:Destroy()
wait(1)
Message()
msg.Text="Game over."
wait(3)
msg:Destroy()
end
Speaking of the Hint function, in line 23, the script is trying to destroy 'Hint', which is a nil variable (a variable without an assignment).
You can either:
- Make the 'hint' variable global and un-capitalize the 'Hint' that uses the 'destroy' method (to convert the nil variable into the correct variable):
function Hint()
hint = Instance.new("Hint", game.Workspace)
hint.Text="Game in progress..."
end
function Message()
msg = Instance.new("Message", game.Workspace)
end
while true do
Message()
msg.Text = "Loading."
wait(4)
msg.Text="Starting new game"
wait(3)
msg.Text="Murderer Mode: '1 life Murderer' is chosen."
wait(2)
msg.Text="Everyone is murderer, Good Luck!"
wait(3)
msg:Destroy()
Hint()
wait(120)
hint:Destroy()
wait(1)
Message()
msg.Text="Game over."
wait(3)
msg:Destroy()
end
or
- Keep the local variable, but destroy the existing hint in the Workspace:
function Hint()
local hint = Instance.new("Hint", game.Workspace)
hint.Text="Game in progress..."
end
function Message()
msg = Instance.new("Message", game.Workspace)
end
while true do
Message()
msg.Text = "Loading."
wait(4)
msg.Text="Starting new game"
wait(3)
msg.Text="Murderer Mode: '1 life Murderer' is chosen."
wait(2)
msg.Text="Everyone is murderer, Good Luck!"
wait(3)
msg:Destroy()
Hint()
wait(120)
game.Workspace.Hint:Destroy()
wait(1)
Message()
msg.Text="Game over."
wait(3)
msg:Destroy()
end
Either will do the job, but using the latter of the two choices will destroy the variables it is assigned to, just in case if you have more than one Message or Hint objects.
1 comment
Thank you :) It helped a lot.