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: PlayerAdded help.

Previous Thread :: Next Thread 
XhymbbQd6 is not online. XhymbbQd6
Joined: 22 Jul 2011
Total Posts: 1468
30 Jul 2012 04:05 PM
Bonus = Instance.new("BoolValue")

function PlayerAdded()
game.Players.PlayerAdded
Bonus:Clone()
Bonus.Parent = game.Players.PlayerAdded
end

script.Parent.PlayerAdded:connect(PlayerAdded)

When a player first enters, they get a value known as Bonus, do I need to add something to make it stay or something? I never used PlayerAdded before, so please can someone help.
Report Abuse
XhymbbQd6 is not online. XhymbbQd6
Joined: 22 Jul 2011
Total Posts: 1468
30 Jul 2012 04:07 PM
Forgot something.

Bonus = Instance.new("BoolValue")

function PlayerAdded()
Bonus.Name = "BonusMode"
game.Players.PlayerAdded
Bonus:Clone()
Bonus.Parent = game.Players.PlayerAdded
end

script.Parent.PlayerAdded:connect(PlayerAdded)
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
30 Jul 2012 04:09 PM
game.Players.ChildAdded:connect(function (newPlayer)
local b = Instance.new("BoolValue", newPlayer);
b.Name = "BonusMode";
end);
Report Abuse
leolion113 is not online. leolion113
Joined: 11 Oct 2008
Total Posts: 3336
30 Jul 2012 04:09 PM
game.Players.PlayerAdded:connect(function(Plyr)
Instance.new("BoolValue", Plyr).Name = "BonusMode"
end)

Tada...
Report Abuse
leolion113 is not online. leolion113
Joined: 11 Oct 2008
Total Posts: 3336
30 Jul 2012 04:10 PM
Darn it. Dr0 posted before...
Report Abuse
XhymbbQd6 is not online. XhymbbQd6
Joined: 22 Jul 2011
Total Posts: 1468
30 Jul 2012 04:11 PM
Soo, if I was inserting more values I would do something like.

game.Players.ChildAdded:connect(function (newPlayer)
local b = Instance.new("BoolValue", newPlayer);
local c = Instance.new("BoolValue", newPlayer);
b.Name = "BonusMode";
c.Name = "Quest1";
end);

Also why are you using C++'s endlines semi colin (Sorry for the spelling)
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
30 Jul 2012 04:12 PM
Yeah, but you don't need to call them b, c, d etc. I just used b cause it was the first letter of bool.

I think the semi-colons look nicer - since using Java I can't write code without them.
Report Abuse
XhymbbQd6 is not online. XhymbbQd6
Joined: 22 Jul 2011
Total Posts: 1468
30 Jul 2012 04:14 PM
I believe C++ owns the Semi colons xD
Report Abuse
XhymbbQd6 is not online. XhymbbQd6
Joined: 22 Jul 2011
Total Posts: 1468
30 Jul 2012 04:16 PM
Final question.

How would I contact Players in a hit script?

function hit(hit)
local hit.game.Players.localplayer.Bonus.Value = false
end

script.Parent.Touched:connect(hit)

Correct? I'll be using values more in this new game.
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
30 Jul 2012 04:16 PM
Java, C#, C, more I haven't heard of, all use semi-colons.
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
30 Jul 2012 04:18 PM
script.Parent.Touched:connect(function (p)
if (not p.Parent:findFirstChild("Humanoid")) then return; end
local plr = game.Players:findFirstChild(p.Parent.Name);
if (plr == nil) then return; end
plr.BonusMode.Value = false;
end);
Report Abuse
XhymbbQd6 is not online. XhymbbQd6
Joined: 22 Jul 2011
Total Posts: 1468
30 Jul 2012 04:22 PM
that didn't work.
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