devTools
|
  |
| Joined: 06 Sep 2014 |
| Total Posts: 7950 |
|
|
| 29 Oct 2014 10:26 PM |
It works for like 5 mins of constant use, but then it breaks so that it wont change your decal. I have a long list of items and decal IDs in a table that all work, but this is the script without the table:
function changeDecal() rand = math.random(1,50) -- Change to the number of Items in the table game.Workspace.Background.Decal.Texture = Items[rand][2] end
game.Players.PlayerAdded:connect(function(plr) plr:WaitForChild("leaderstats") plr.leaderstats:WaitForChild("Points") plr.leaderstats:WaitForChild("Wins")
changeDecal()
while wait() do wait(1)
plr.Chatted:connect(function(msg) if msg:lower() == Items[rand][1] then plr.leaderstats.Points.Value = plr.leaderstats.Points.Value + 50 plr.leaderstats.Wins.Value = plr.leaderstats.Wins.Value + 1 wait(1) changeDecal() end end) end end)
Help?
| devTools || Builder | Forumer | Beginning Scripter | Add 1.5k Posts | |
|
|
| Report Abuse |
|
|
devTools
|
  |
| Joined: 06 Sep 2014 |
| Total Posts: 7950 |
|
|
| 29 Oct 2014 10:31 PM |
b1
| devTools || Builder | Forumer | Beginning Scripter | Add 1.5k Posts | |
|
|
| Report Abuse |
|
|
devTools
|
  |
| Joined: 06 Sep 2014 |
| Total Posts: 7950 |
|
|
| 29 Oct 2014 10:50 PM |
b2
| devTools || Builder | Forumer | Beginning Scripter | Add 1.5k Posts | |
|
|
| Report Abuse |
|
|
devTools
|
  |
| Joined: 06 Sep 2014 |
| Total Posts: 7950 |
|
|
| 29 Oct 2014 10:58 PM |
b3
| devTools || Builder | Forumer | Beginning Scripter | Add 1.5k Posts | |
|
|
| Report Abuse |
|
|
nacker
|
  |
| Joined: 06 Oct 2009 |
| Total Posts: 6034 |
|
|
| 29 Oct 2014 11:52 PM |
| would help if you could include the table |
|
|
| Report Abuse |
|
|
devTools
|
  |
| Joined: 06 Sep 2014 |
| Total Posts: 7950 |
|
|
| 30 Oct 2014 12:16 AM |
Its 50 tables inside a table like this:
Items = { {"evil skeptic","http://www.roblox.com/asset/?id=77727836"}, {"hyperlaser","http://www.roblox.com/asset/?id=180538479"}}
| devTools || Builder | Forumer | Beginning Scripter | Add 1.5k Posts | |
|
|
| Report Abuse |
|
|
devTools
|
  |
| Joined: 06 Sep 2014 |
| Total Posts: 7950 |
|
|
| 30 Oct 2014 12:42 AM |
Help?
| devTools || Builder | Forumer | Beginning Scripter | Add 1.5k Posts | |
|
|
| Report Abuse |
|
|
|
| 30 Oct 2014 12:54 AM |
| I don't understand how a script can only work sometimes. A script usually works all the time or never works in the first place. |
|
|
| Report Abuse |
|
|
|
| 30 Oct 2014 01:04 AM |
| @lego not necessarily. a lot of beginners tend to make glitchy scripts which break easily |
|
|
| Report Abuse |
|
|
|
| 30 Oct 2014 01:13 AM |
| Ah I see, there is a math.random at the beginning. Maybe it's outputting numbers that the script doesn't know what to do with so then it errors? |
|
|
| Report Abuse |
|
|
devTools
|
  |
| Joined: 06 Sep 2014 |
| Total Posts: 7950 |
|
|
| 30 Oct 2014 06:43 AM |
| But I set parameters for the random. |
|
|
| Report Abuse |
|
|
|
| 30 Oct 2014 07:09 AM |
you can do this so much easier, but I don't fix over-complicated scripts.
mom, i created admin, are you proud? |
|
|
| Report Abuse |
|
|
|
| 30 Oct 2014 07:10 AM |
It's doing it because it's choosing numbers like 1.2393842, not just Integers.
mom, i created admin, are you proud? |
|
|
| Report Abuse |
|
|
|
| 30 Oct 2014 07:13 AM |
@FireDesign umm http://wiki.roblox.com/index.php?title=Function_dump/Mathematical_functions#math.random
"math.random ([m [, n]])
This function returns a random integer between m and n"
~The herp lerped a derp~ |
|
|
| Report Abuse |
|
|
devTools
|
  |
| Joined: 06 Sep 2014 |
| Total Posts: 7950 |
|
|
| 30 Oct 2014 07:14 AM |
| How do I make it only choose whole numbers? |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 30 Oct 2014 07:21 AM |
| Fire was being stupid; it already returns only whole numbers. |
|
|
| Report Abuse |
|
|