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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 30 Jul 2012 04:09 PM |
game.Players.PlayerAdded:connect(function(Plyr) Instance.new("BoolValue", Plyr).Name = "BonusMode" end)
Tada... |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2012 04:10 PM |
| Darn it. Dr0 posted before... |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| Joined: 22 Jul 2011 |
| Total Posts: 1468 |
|
|
| 30 Jul 2012 04:14 PM |
| I believe C++ owns the Semi colons xD |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 22 Jul 2011 |
| Total Posts: 1468 |
|
| |
|