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: Leaderboard Problem (Disaster Script wont give them points!)

Previous Thread :: Next Thread 
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
17 Feb 2014 01:52 PM
-- NINGAKIWI

disasters = {"Valcano", "Falling Lava", "Tornado"} -- This is where you list the names models that you want to use for disasters.
-- Disaster names are case-sensitive and all disaster models must be in the lighting

countdownTime = 10 -- Time between disasters.
disasterTime = 64 -- The ammount of time that the disaster will be in the game before it is removed.

countdownMessage = "Next disaster in %s seconds!" -- The message displayed between disasters. %s will be replaced with the number of seconds left.
disasterMessage = "Disaster: %s" -- The message displayed when a disaster occurs. %s will be replaced with the disaster name. Set to nil if you do not want a message

-- Unless you know what you are doing, please leave the below code alone.
items = {}
leaderboard = game.Workspace:findFirstChild("BTS Leaderboard") -- Dont need to use with Ajedi´s BTS leaderboard, but if you want...
local w = game.Workspace:getChildren()
for i=1,#w do
if w[i].Name == "leaderboard" and w[i]:findFirstChild("running") ~= nil and w[i]:findFirstChild("points") ~= ni then
leaderboard = w[i]
end
end
for i=1,#disasters do
local item = game.Lighting:findFirstChild(disasters[i])
if item ~= nil then
item.Parent = nil
table.insert(items, item)
else
print("Error! ", disasters[i], " was not found!")
end
end

function chooseDisaster()
return items[math.random(#items)]
end

function sethint(text)
local hint = game.Workspace:findFirstChild("hint")
if (hint ~= nil) then
hint.Text = text
else
print("Hint does not exist, creating...")
h = Instance.new("Hint")
h.Name = "hint"
h.Text = text
h.Parent = game.Workspace
end
--print("Hint set to: ", text)
end

function removeHint()
hint = game.Workspace:findFirstChild("hint")
if (hint ~= nil) then hint:remove() end
end

function countdown(time)
sethint(string.format(countdownMessage, tostring(time)))
while (time > 0) do
wait(1)
time = time - 1
sethint(string.format(countdownMessage, tostring(time)))
end
removeHint()
return true
end

while true do
countdown(countdownTime)

if leaderboard ~= nil and leaderboard:findFirstChild("running") and leaderboard:findFirstChild("points") then
leaderboard.points.Value = 30
leaderboard.running.Value = true
end

local m = chooseDisaster():clone()

if disasterMessage ~= nil then
local msg = Instance.new("Message")
msg.Name = "DisasterMsg"
msg.Text = string.format(disasterMessage, m.Name)
msg.Parent = game.Workspace
wait(3)
msg.Parent = nil
end

m.Parent = game.Workspace
m:makeJoints()
wait(disasterTime)
m:remove()

if leaderboard ~= nil then
leaderboard.running.Value = false
end
end
Report Abuse
Drybones3363 is not online. Drybones3363
Joined: 16 Aug 2013
Total Posts: 1547
17 Feb 2014 01:53 PM
ur giving them 30 points
not +30
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
17 Feb 2014 01:54 PM
When I put a + in front of the 30 it gives me that line has an error..
Report Abuse
MarioKartAddict is not online. MarioKartAddict
Joined: 11 Nov 2009
Total Posts: 42774
17 Feb 2014 01:55 PM
leaderboard.points.Value = leaderboard.points.Value + 30
Report Abuse
Drybones3363 is not online. Drybones3363
Joined: 16 Aug 2013
Total Posts: 1547
17 Feb 2014 01:56 PM
leaderstats.Points.Value + 30

im guessing u dont know how to script because this script looks like a free model
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
17 Feb 2014 01:56 PM
disasters = {"Valcano", "Falling Lava", "Tornado"} -- This is where you list the names models that you want to use for disasters.
-- Disaster names are case-sensitive and all disaster models must be in the lighting

countdownTime = 10 -- Time between disasters.
disasterTime = 64 -- The ammount of time that the disaster will be in the game before it is removed.

countdownMessage = "Next disaster in %s seconds!" -- The message displayed between disasters. %s will be replaced with the number of seconds left.
disasterMessage = "Disaster: %s" -- The message displayed when a disaster occurs. %s will be replaced with the disaster name. Set to nil if you do not want a message

-- Unless you know what you are doing, please leave the below code alone.
items = {}
leaderboard = game.Workspace:findFirstChild("BTS Leaderboard") -- Dont need to use with Ajedi´s BTS leaderboard, but if you want...
local w = game.Workspace:getChildren()
for i=1,#w do
if w[i].Name == "leaderboard" and w[i]:findFirstChild("running") ~= nil and w[i]:findFirstChild("points") ~= ni then
leaderboard = w[i]
end
end
for i=1,#disasters do
local item = game.Lighting:findFirstChild(disasters[i])
if item ~= nil then
item.Parent = nil
table.insert(items, item)
else
print("Error! ", disasters[i], " was not found!")
end
end

function chooseDisaster()
return items[math.random(#items)]
end

function sethint(text)
local hint = game.Workspace:findFirstChild("hint")
if (hint ~= nil) then
hint.Text = text
else
print("Hint does not exist, creating...")
h = Instance.new("Hint")
h.Name = "hint"
h.Text = text
h.Parent = game.Workspace
end
--print("Hint set to: ", text)
end

function removeHint()
hint = game.Workspace:findFirstChild("hint")
if (hint ~= nil) then hint:remove() end
end

function countdown(time)
sethint(string.format(countdownMessage, tostring(time)))
while (time > 0) do
wait(1)
time = time - 1
sethint(string.format(countdownMessage, tostring(time)))
end
removeHint()
return true
end

while true do
countdown(countdownTime)

if leaderboard ~= nil and leaderboard:findFirstChild("running") and leaderboard:findFirstChild("points") then
leaderboard.points.Value + 30
leaderboard.running.Value = true
end

local m = chooseDisaster():clone()

if disasterMessage ~= nil then
local msg = Instance.new("Message")
msg.Name = "DisasterMsg"
msg.Text = string.format(disasterMessage, m.Name)
msg.Parent = game.Workspace
wait(3)
msg.Parent = nil
end

m.Parent = game.Workspace
m:makeJoints()
wait(disasterTime)
m:remove()

if leaderboard ~= nil then
leaderboard.running.Value = false
end
end
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
17 Feb 2014 01:56 PM
I've edited most of this script. It was a map changer, I completely changed it...
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
17 Feb 2014 01:57 PM
Also, when doing randomchoose, try not to use spaces. It confuses the game a bit.
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
17 Feb 2014 01:57 PM
Also, when doing randomchoose, try not to use spaces. It confuses the game a bit.

So, ima go eat sum squirrelz. KK!???#2wq%#!
Report Abuse
Drybones3363 is not online. Drybones3363
Joined: 16 Aug 2013
Total Posts: 1547
17 Feb 2014 01:57 PM
YOU JUST HAVE TO EDIT WHAT I TOLD U
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
17 Feb 2014 01:58 PM
Even with the space, it's saying = expected near +
Report Abuse
Drybones3363 is not online. Drybones3363
Joined: 16 Aug 2013
Total Posts: 1547
17 Feb 2014 01:59 PM
wat did u put?
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
17 Feb 2014 02:00 PM
I put
leaderstats.Points.Value + 30
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
17 Feb 2014 02:00 PM
This is the part I think i'm having problems with...
if leaderboard ~= nil and leaderboard:findFirstChild("running") and leaderboard:findFirstChild("points") then
leaderstats.Points.Value + 30
leaderboard.running.Value = true
end
Report Abuse
Drybones3363 is not online. Drybones3363
Joined: 16 Aug 2013
Total Posts: 1547
17 Feb 2014 02:02 PM
leaderstats.Points.Value = leaderstats.Points.Value + 30

i would suggest learning LUA
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
17 Feb 2014 02:05 PM
It still doesn't work! D:
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
17 Feb 2014 02:09 PM
b1
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