|
| 11 Dec 2016 09:53 AM |
So basically I am trying to get a message printed into the console on a npc's death, but for some reason it doesn't want to work. I tried looking at the roblox wiki but I couldn't find anything useful. (Btw I tried the same exact script in a regular script and a local one)
james = game.workspace.James jamesHumanoid = game.workspace.James.Humanoid
if jamesHumanoid.Health == 0 then print ("James Kicked the Bucket") end |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 09:57 AM |
Your missing the 'Then' in your if statement.
-The Time Traveling Knight of OT |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 09:58 AM |
james = game.workspace.James jamesHumanoid = game.workspace.James.Humanoid
if jamesHumanoid.Health == 0 then print ("James Kicked the Bucket") end
wat was that mr tomato head? |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 09:59 AM |
he wasn't missing then. he just put it on the wrong line.
wat was that mr tomato head? |
|
|
| Report Abuse |
|
|
Jaidenati
|
  |
| Joined: 10 Oct 2012 |
| Total Posts: 192 |
|
|
| 11 Dec 2016 10:00 AM |
You didn't capitalize the W in workspace. james = game.Workspace.James jamesHumanoid = james.Humanoid |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 10:00 AM |
You should probably loop it as well, because that will check the health instantaneously. So unless James is already dead when you run it, nothing will appear.
-The Time Traveling Knight of OT |
|
|
| Report Abuse |
|
|
| |
|
|
| 11 Dec 2016 10:17 AM |
I don't think I made this loop correctly because I am still not getting an output
james = game.workspace.James jamesHumanoid = james.Humanoid
repeat
if jamesHumanoid.Health == 0 then print ("James Kicked the Bucket") end
wait(5)
until jamesHumanoid.Health == 0
|
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 10:23 AM |
james = game.Workspace.James.Humanoid
while wait() do if james.Health == 0 then print("James Kicked the Bucket") break end
wat was that mr tomato head? |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 10:24 AM |
james = game.Workspace.James.Humanoid
while wait() do if james.Health == 0 then print("James Kicked the Bucket") break end end
mb forgot the extra end
wat was that mr tomato head? |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 10:26 AM |
local James = game.Workspace.James repeat wait(5) if James.Humanoid.Health == 0 then print("James Kicked the Bucket") end until James.Humanoid.Health == 0
You forgot to capitalize James when you were defining what JamesHumanoid was btw.
-The Time Traveling Knight of OT |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 10:28 AM |
@mylastcomment nvm, you defined James as james.
-The Time Traveling Knight of OT |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 10:32 AM |
| THANK YOU GUYS!!!!!!!!!!!! |
|
|
| Report Abuse |
|
|
|
| 12 Dec 2016 07:23 PM |
Hey guys does anyone know how to fix this error: Teleport exception: HTTP 400 (HTTP/1.1 400 Bad Request)
(BTW I made it so when James dies you teleport to the next level) |
|
|
| Report Abuse |
|
|
|
| 12 Dec 2016 07:27 PM |
| Also if you want to see the entire script here it is = local james = game.Workspace.Jamesames local TeleportService = game:GetService("TeleportService") local level1Id = ######### repeat wait(5) if james.Humanoid.Health ## # then print("James Kicked the Bucket") local player = game.Players:GetChildren() for _, player in pairs(game.Players:GetPlayers()) do if player.Character then TeleportService:Teleport(level1Id, player) end end end until james.Humanoid.Health == 0 |
|
|
| Report Abuse |
|
|
|
| 12 Dec 2016 07:28 PM |
@mylastcomment
Thanks Roblox for that
@all
Sorry about the hashtags |
|
|
| Report Abuse |
|
|
|
| 12 Dec 2016 07:35 PM |
local james = game.Workspace.Jamesames local TeleportService = game:GetService("TeleportService") local level1Id = (Insert Id here)
repeat wait(5) if james.Humanoid.Health == 0 then print("James Kicked the Bucket") local player = game.Players:GetChildren() for _, player in pairs(game.Players:GetPlayers()) do if player.Character then TeleportService:Teleport(level1Id, player) end end end
until james.Humanoid.Health == 0
|
|
|
| Report Abuse |
|
|