Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How To Reset Data?

Asked by 10 years ago

Hi c: I recently made a Fairy Tail game (anime) I have made a script so that when the player enters the game for the first time, they are given a random tool from lighting, and then I made a separate script that saves it. Every few months I want to reset the data so that they spawn with a new tool :o I have tried everything I know, and I just can't seem to reset it. If there a way to reset it? If anyone can tell me what to do, that would be great :) The save script is quite long, so I won't post it.

[The Distribution Script]

me = script.Parent.Parent
owner = "EternityOfMagic"
wait(1)

if me.PlayerGui:findFirstChild("HealthGUI") ~= nil then
     me.PlayerGui:findFirstChild("HealthGUI"):remove()
end

while true do
wait(.1)


if me:findFirstChild("Data") ~= nil then

if me:findFirstChild("Data") ~= nil then
if me.Data.Magic1.Value ~= "" then
if me.Backpack:findFirstChild("opened") == nil then

if me.Name == "EternityOfMagic" then
game.Lighting.SatanSoul:clone().Parent = me.Backpack
o = Instance.new("StringValue", me.Backpack)
o.Name = "opened"   
end
if me.Data.Magic1.Value == "Water"  then
game.Lighting.Water:clone().Parent = me.Backpack
o = Instance.new("StringValue", me.Backpack)
o.Name = "opened"
end
if me.Data.Magic1.Value == "Earth"  then
game.Lighting.Earth:clone().Parent = me.Backpack
o = Instance.new("StringValue", me.Backpack)
o.Name = "opened"
end
if me.Data.Magic1.Value == "Wind"  then
game.Lighting.Wind:clone().Parent = me.Backpack
o = Instance.new("StringValue", me.Backpack)
o.Name = "opened"
end
if me.Data.Magic1.Value == "IceMake"  then
game.Lighting.IceMake:clone().Parent = me.Backpack
o = Instance.new("StringValue", me.Backpack)
o.Name = "opened"
end
if me.Data.Magic1.Value == "Gravity"  then
game.Lighting.Gravity:clone().Parent = me.Backpack
o = Instance.new("StringValue", me.Backpack)
o.Name = "opened"
end
if me.Data.Magic1.Value == "Crash"  then
game.Lighting.Crash:clone().Parent = me.Backpack
o = Instance.new("StringValue", me.Backpack)
o.Name = "opened"
end
if me.Data.Magic1.Value == "Light"  then
game.Lighting.Light:clone().Parent = me.Backpack
o = Instance.new("StringValue", me.Backpack)
o.Name = "opened"
end
if me.Data.Magic1.Value == "Snow"  then
game.Lighting.Snow:clone().Parent = me.Backpack
o = Instance.new("StringValue", me.Backpack)
o.Name = "opened"
end
if me.Data.Magic1.Value == "Sand"  then
game.Lighting.Sand:clone().Parent = me.Backpack
o = Instance.new("StringValue", me.Backpack)
o.Name = "opened"
end
if me.Data.Magic1.Value == "Gun"  then
game.Lighting.Gun:clone().Parent = me.Backpack
o = Instance.new("StringValue", me.Backpack)
o.Name = "opened"
end
if me.Data.Magic1.Value == "SolidScript"  then
game.Lighting.SolidScript:clone().Parent = me.Backpack
o = Instance.new("StringValue", me.Backpack)
o.Name = "opened"
end
end
end
if me.Data.Magic1.Value ~= "" and me.PlayerGui.GameGui:findFirstChild("MagicCast") == nil and me.PlayerGui.GameGui:findFirstChild("GuiSkill") == nil then
game.Lighting["MagicCast"]:clone().Parent = me.PlayerGui.GameGui
game.Lighting["GuiSkill"]:clone().Parent = me.PlayerGui.GameGui     
end
if me.Data.Magic1.Value == "" then
jan = math.random(1,11)
        if jan == 1 then 
        me.Data.Magic1.Value = "Light"
        elseif jan == 2 then
        me.Data.Magic1.Value = "Water"
        elseif jan == 3 then
        me.Data.Magic1.Value = "Earth"
        elseif jan == 4 then
        me.Data.Magic1.Value = "Wind"
        elseif jan == 5 then
        me.Data.Magic1.Value = "IceMake"
        elseif jan == 6 then
        me.Data.Magic1.Value = "Gravity"
        elseif jan == 7 then
        me.Data.Magic1.Value = "Crash"
        elseif jan == 8 then
        me.Data.Magic1.Value = "Sand"
        elseif jan == 9 then
        me.Data.Magic1.Value = "Snow"   
        elseif jan == 10 then
        me.Data.Magic1.Value = "Gun"    
        elseif jan == 11 then
        me.Data.Magic1.Value = "SolidScript"    

        end
end

end

end

end

0
Not sure what you're trying to do, but this code is terribly inefficient. You need to use more tables and for loops to store your data, instead of all those if statements. Perci1 4988 — 10y

Answer this question