generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Game Design
Home Search
 

Re: I need help w/ this script

Previous Thread :: Next Thread 
yoyo5724900 is online. yoyo5724900
Joined: 19 Dec 2010
Total Posts: 91
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
CorruptScript is online. CorruptScript
Joined: 16 Nov 2011
Total Posts: 3873
11 Dec 2016 09:57 AM
Your missing the 'Then' in your if statement.


-The Time Traveling Knight of OT
Report Abuse
StringedVortex is not online. StringedVortex
Joined: 28 Jun 2015
Total Posts: 1846
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
StringedVortex is not online. StringedVortex
Joined: 28 Jun 2015
Total Posts: 1846
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 is online. 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
CorruptScript is online. CorruptScript
Joined: 16 Nov 2011
Total Posts: 3873
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
yoyo5724900 is online. yoyo5724900
Joined: 19 Dec 2010
Total Posts: 91
11 Dec 2016 10:03 AM
Thank you guys so much!
Report Abuse
yoyo5724900 is online. yoyo5724900
Joined: 19 Dec 2010
Total Posts: 91
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
StringedVortex is not online. StringedVortex
Joined: 28 Jun 2015
Total Posts: 1846
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
StringedVortex is not online. StringedVortex
Joined: 28 Jun 2015
Total Posts: 1846
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
CorruptScript is online. CorruptScript
Joined: 16 Nov 2011
Total Posts: 3873
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
CorruptScript is online. CorruptScript
Joined: 16 Nov 2011
Total Posts: 3873
11 Dec 2016 10:28 AM
@mylastcomment nvm, you defined James as james.


-The Time Traveling Knight of OT
Report Abuse
yoyo5724900 is online. yoyo5724900
Joined: 19 Dec 2010
Total Posts: 91
11 Dec 2016 10:32 AM
THANK YOU GUYS!!!!!!!!!!!!
Report Abuse
yoyo5724900 is online. yoyo5724900
Joined: 19 Dec 2010
Total Posts: 91
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
yoyo5724900 is online. yoyo5724900
Joined: 19 Dec 2010
Total Posts: 91
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
yoyo5724900 is online. yoyo5724900
Joined: 19 Dec 2010
Total Posts: 91
12 Dec 2016 07:28 PM
@mylastcomment

Thanks Roblox for that

@all

Sorry about the hashtags
Report Abuse
yoyo5724900 is online. yoyo5724900
Joined: 19 Dec 2010
Total Posts: 91
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image