eyeontheprize Newbie
Joined: 25 May 2008 Posts: 3 Location: Anywhere but nowhere
|
Posted: Sat Jun 14, 2008 11:10 pm Post subject: [SCRIPT} Save/Load Script |
|
|
Saves entire systems!
Code: |
random = 17
function onChatted(msg, recipient, speaker)
local source = string.lower(speaker.Name)
msg = string.lower(msg)
if string.sub(msg, 1, 5) == "save/" then
local stats = speaker:findFirstChild("leaderstats")
if stats ~= nil then
c = stats:GetChildren()
values = { }
for i = 1, #c do
if c[i].className == "IntValue" then
table.insert(values, c[i].Value * random)
end
end
local code = table.concat(values, "/")
local m = Instance.new("Message")
m.Text = "Your code: "..code.."/"
m.Parent = speaker
wait(10)
m:remove()
end
end
if string.sub(msg, 1, 5) == "load/" then
local string = string.sub(msg, 6, #msg)
local stats = speaker:findFirstChild("leaderstats")
if stats ~= nil then
c = stats:GetChildren()
for i =1, #c do
if c[i].className == "IntValue" then
a = string.find(string, "/")
if a ~= nil then
print(a)
local value = tonumber(string.sub(string, 1, a -1))
value = value / random
if value == math.ceil(value) and value == math.floor(value) then
print(value)
c[i].Value = value
string = string.sub(string, a +1, #string)
local m = Instance.new("Message")
m.Text = "Your code has been loaded"
m.Parent = speaker
wait(3)
m:remove()
else
local m = Instance.new("Message")
m.Text = "NO CHEATING"
m.Parent = speaker
wait(3)
m:remove()
end
end
end
end
end
end
end
function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end
game.Players.ChildAdded:connect(onPlayerEntered)
| [/code] _________________ The following statement is false
The previous statement is true
I like the cake inside of the prize |
|
LastNote678 Master Poster
Joined: 20 May 2008 Posts: 205 Location: In your head, eating your subconscious.
|
Posted: Mon Jun 16, 2008 10:37 pm Post subject: |
|
|
The script breaks every time it reaches ". _________________ Am I leaving, Am I going. Am I speeding, am I slowing. Just, out of space for now.
Reminder: We're all under the same sky. |
|