So it is supposed to only print "That brick got rekt" if the brick is deleted, but when I took away the line that calls the Partwreck() function, it still printed "That brick got rekt" instead of "Why dat brick still alive??" Anyone know why? Also the script is in workspace, and it is named "Script1"
function Partwreck() local Tester = workspace.Tester wait(3) workspace.Tester:Destroy() end Partwreck() wait(1) function Destro() local Script1 = workspace.Script1 if Tester == nil then print("That brick got rekt") if Tester ~= nil then print("Why dat brick still alive??") end end end Destro()
Use else if for the second if, and call the local variables outside of the functions.
local Tester = workspace.Tester --Local Variables called outside of functions. local Script1 = workspace.Script1 function Partwreck() wait(3) workspace.Tester:Destroy() end Partwreck() wait(1) function Destro() if Tester == nil then print("That brick got rekt") elseif Tester ~= nil then -- Use elseif instead of if print("Why dat brick still alive??") end end Destro()