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 » Scripting Helpers
Home Search
 

Re: There is a simple mistake which I can't find...

Previous Thread :: Next Thread 
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
11 Jun 2014 02:58 PM
So this is a function for showing a message at the top of the screen
IMPORTANT: BEFORE the function is called, "Zombie" is picked as only 1 player.
What I want is to show one message to all players who are not Zombie, and a different message to only the player who IS zombie.

The Problem: It's showing the zombie messages for all players, not just the one zombie.


-----------------------------------------------------

message = nil

function showMessage(Msg)
if message == nil then
c = game.Players:GetPlayers()
for i = 1, #c do
message = c[i]:WaitForChild("PlayerGui"):WaitForChild("GameGui"):WaitForChild("Message")
if Msg ~= MsgYouAreHuman or Msg ~= MsgYouAreZombie then
message.Image = URL .. Msg
-- blah blah unrelated message showing code here
elseif Msg == MsgYouAreHuman then
if c[i] ~= Zombie then
message.Image = URL .. MsgYouAreHuman
-- blah blah same unrelated message showing code here
end
elseif Msg == MsgYouAreZombie then
if c[i] == Zombie then
message.Image = URL .. MsgYouAreZombie
-- blah blah same unrelated message showing code here
end
end
end
end
message = nil
end
Report Abuse
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
11 Jun 2014 04:00 PM
Bump
Report Abuse
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
11 Jun 2014 04:03 PM
didnt connect the function?
Report Abuse
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
11 Jun 2014 04:06 PM
Did you read the top part or just the script...? -_-
Report Abuse
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
11 Jun 2014 04:24 PM
bump
Report Abuse
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
11 Jun 2014 04:26 PM
Also how I call it is:

blah blah pick a player, assign them to "Zombie" (I tested it and this part works)
showMessage(MsgYouAreHuman)
showMessage(MsgYouAreZombie)
Report Abuse
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
11 Jun 2014 04:51 PM
bump
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
11 Jun 2014 04:55 PM
I get confused right around here,
if Msg ~= MsgYouAreHuman or Msg ~= MsgYouAreZombie then
--What are you trying to do and what are MsgYouAreHuman etc.
Report Abuse
Brickman2010 is not online. Brickman2010
Joined: 20 Nov 2009
Total Posts: 5547
11 Jun 2014 04:56 PM
Convert this:

showMessage(MsgYouAreHuman)
showMessage(MsgYouAreZombie)

to this:

showMessage("MsgYouAreHuman")
showMessage("MsgYouAreZombie")

In other words, you are calling a variable right now. Use string instead
Report Abuse
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
11 Jun 2014 05:03 PM
No it's supposed to be a variable

They are variables for IDs

only the zombie one is showing though
Report Abuse
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
11 Jun 2014 05:03 PM
And humans are getting the zombie message when they aren't supposed to
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
11 Jun 2014 05:04 PM
Please reveal those vriables or at least describe the type -__-
Report Abuse
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
11 Jun 2014 06:05 PM
The only undefined variables are MsgYouAreHuman and MsgYouAreZombie
They both hold a number which is the ID for the image
Report Abuse
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
11 Jun 2014 06:25 PM
bump
Report Abuse
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
11 Jun 2014 06:32 PM
Haha what did I tell you. Silly mistake.

I needed to change "or" to "and"

Changed
"if Msg ~= MsgYouAreHuman or Msg ~= MsgYouAreZombie then"
to
"if Msg ~= MsgYouAreHuman and Msg ~= MsgYouAreZombie then"
and it worked. Yey.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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