Jinxy
|
  |
| Joined: 04 Aug 2007 |
| Total Posts: 18317 |
|
|
| 08 Jul 2011 06:06 PM |
| Okay, the title is a bit stupidly worded, but my question is, let's say that the leaderboard is counting how many times a brick has been found. Normally, when the brick is found, it adds one, and if you touch it again, it adds another. I was wondering, is there away to stop this, so that way if you touch it once, it only counts once for the person who touched it. |
|
|
| Report Abuse |
|
|
Xknite
|
  |
| Joined: 03 Jul 2008 |
| Total Posts: 181 |
|
|
| 08 Jul 2011 06:11 PM |
You could create an IntValue System. I did for a spawn thing I made... You could create a model with all the IntValues in. Put a script that clones those IntValues into a player that is enterring. Then a script in each script that makes the IntValue in the Player = 1(or another number). Keep the leaderboard. Then have a script that is cloned with the IntValues that adds up the Values of the IntValues and puts it in the leaderboard.
Goodluck scripting =P |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2011 06:11 PM |
| Yes. Insert some kind of value into the player when they find a brick. then When they find a brick, check if that value is there. If it isn't, add the point, if it is, do nothing. |
|
|
| Report Abuse |
|
|
Xknite
|
  |
| Joined: 03 Jul 2008 |
| Total Posts: 181 |
|
|
| 08 Jul 2011 06:12 PM |
| Correction-- "Then a script in each script" That should be "Then a script in each brick..." |
|
|
| Report Abuse |
|
|
Jinxy
|
  |
| Joined: 04 Aug 2007 |
| Total Posts: 18317 |
|
|
| 08 Jul 2011 06:18 PM |
So, along the lines of what the Dr said it would be like this:
int.value=1
check int.value of player
if int.value equals to 1 then,
add 0 points to player score
if int.value does not equal to 1 then,
add 1 point to player score. |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2011 06:19 PM |
Yup, that would work :D
Or instead of checking a value, you could do this:
put SomeTypeOfValue into the player
check if SomeTypeOfValue is there
if it is there
add 0 points
if it isn't there
add 1 point |
|
|
| Report Abuse |
|
|
Xknite
|
  |
| Joined: 03 Jul 2008 |
| Total Posts: 181 |
|
|
| 08 Jul 2011 06:20 PM |
| Yeah, which was I also slightly mentioned. You just have to script it. |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2011 06:22 PM |
| And you can use a BoolValue to check if the brick has been touched before, I think I misunderstood the question. |
|
|
| Report Abuse |
|
|
Jinxy
|
  |
| Joined: 04 Aug 2007 |
| Total Posts: 18317 |
|
|
| 08 Jul 2011 06:23 PM |
| Alrighty.... let me put that down into my notes. |
|
|
| Report Abuse |
|
|
Jinxy
|
  |
| Joined: 04 Aug 2007 |
| Total Posts: 18317 |
|
|
| 08 Jul 2011 06:28 PM |
| (Crap the wiki won't load so I don't know what a boolvalue is) |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2011 06:29 PM |
| A bool value is a value that is either false or true so it would be false at start but when the brick was touched it would change to true. |
|
|
| Report Abuse |
|
|
Jinxy
|
  |
| Joined: 04 Aug 2007 |
| Total Posts: 18317 |
|
|
| 08 Jul 2011 06:30 PM |
| Would the bool value only count for the one person, or would it count for all? |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2011 06:31 PM |
| It would count for all, another thing you could do is use a number of string values depending on the number of players, so for each player a string value and you could check if any of them matches the name of the player that touched that part. |
|
|
| Report Abuse |
|
|
Jinxy
|
  |
| Joined: 04 Aug 2007 |
| Total Posts: 18317 |
|
|
| 08 Jul 2011 06:33 PM |
| that seems a bit more complicated then the cloning process. |
|
|
| Report Abuse |
|
|
Jinxy
|
  |
| Joined: 04 Aug 2007 |
| Total Posts: 18317 |
|
|
| 08 Jul 2011 07:30 PM |
| So, how do I make my own leader board? I can find one and tweak it, but I want to do one from scratch. |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2011 07:32 PM |
Instance an IntValue into the player and name it"leaderstats" and then instance more IntValues into the leaderstats value. The name of those values will be the name of the stat, and the value of them will be the number displayed.
ex:
DrAgonmoray (Player) --leaderstats (IntValue) ----Points (IntValue) |
|
|
| Report Abuse |
|
|
Jinxy
|
  |
| Joined: 04 Aug 2007 |
| Total Posts: 18317 |
|
|
| 08 Jul 2011 07:34 PM |
Instance an IntValue into the player and name it"leaderstats" and then instance more IntValues into the leaderstats value. The name of those values will be the name of the stat, and the value of them will be the number displayed.
Do I create the script in the workspace or in the Players? |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2011 07:35 PM |
| Put the script in workspace |
|
|
| Report Abuse |
|
|
Jinxy
|
  |
| Joined: 04 Aug 2007 |
| Total Posts: 18317 |
|
|
| 08 Jul 2011 07:36 PM |
| (I was about to ask if a normal or local one, but then I realized that would be stupid...) |
|
|
| Report Abuse |
|
|
Jinxy
|
  |
| Joined: 04 Aug 2007 |
| Total Posts: 18317 |
|
|
| 08 Jul 2011 07:41 PM |
So the script SHOULD read:
while true do if newPlayer.Character ~= nil then break end wait(5) end
stats.Parent = newPlayer
else
local stats = Instance.new("IntValue") stats.Name = "leaderstats"
local kills = Instance.new("IntValue") cats.Name = "Cats discovered" cats.Value = 0
cats.Parent = stats |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2011 07:43 PM |
Try this instead:
game.Players.PlayerAdded:connect(function(np) local stats = Instance.new("IntValue", np) stats.Name = "leaderstats" local kills = Instance.new("IntValue", np) kills.Name = "Cats Discovered" kills.Value = 0 end) |
|
|
| Report Abuse |
|
|
Jinxy
|
  |
| Joined: 04 Aug 2007 |
| Total Posts: 18317 |
|
|
| 08 Jul 2011 07:44 PM |
| Why name it kills.name/kills.Value? |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2011 07:45 PM |
| Because you called it kills, not cats |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2011 07:46 PM |
Or just use a table
Touchers = {} a = 1 b == false
brick.Touched:connect(function(p) for i = 1#Touchers do if p.Parent.Name == Touchers[i].Name then b = true end end if b ~= true then Touchers[a] = p.Parent.Name else b = false end end) |
|
|
| Report Abuse |
|
|
Jinxy
|
  |
| Joined: 04 Aug 2007 |
| Total Posts: 18317 |
|
|
| 08 Jul 2011 07:46 PM |
>.O I getcha, let's try this again:
while true do if newPlayer.Character ~= nil then break end wait(5) end
stats.Parent = newPlayer
else
local stats = Instance.new("IntValue") stats.Name = "leaderstats"
local cats = Instance.new("IntValue") cats.Name = "Cats discovered" cats.Value = 0
cats.Parent = stats |
|
|
| Report Abuse |
|
|