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

My script only works in roblox studio however not in the actual game?

Asked by 4 years ago
Edited 4 years ago
``01    game.Players.PlayerAdded:Connect(function(Plr)
02      local stats = Instance.new("Folder", Plr)
03      stats.Name = "Data"
04      --- Level System
05      local Levels = Instance.new("IntValue", stats)
06      Levels.Name = "Levels"
07      Levels.Value = 1
08      local Exp = Instance.new("IntValue", stats)
09      Exp.Name = "Exp"
10      Exp.Value = 0
11      local ExpNeed = Instance.new("IntValue", stats)
12      ExpNeed.Name = "ExpNeed"
13      ExpNeed.Value = 200
14      --- Money System
15      local Beli = Instance.new("IntValue", stats)
16      Beli.Name = "Beli"
17      Beli.Value = 0
18      local Bounty = Instance.new("IntValue", stats)
19      Bounty.Name = "Bounty"
20      Bounty.Value = 1
21      --- Stats Text
22      local HealthP = Instance.new("IntValue", stats)
23      HealthP.Name = "HealthP"
24      HealthP.Value = 0
25      local MeleeP = Instance.new("IntValue", stats)
26      MeleeP.Name = "MeleeP"
27      MeleeP.Value = 0
28      local SpeedP = Instance.new("IntValue", stats)
29      SpeedP.Name = "SwordP"
30      SpeedP.Value = 0
31      local DevilFruitP = Instance.new("IntValue", stats)
32      DevilFruitP.Name = "DevilFruitP"
33      DevilFruitP.Value = 0
34      --- Stats System
35      local Points = Instance.new("IntValue", stats)
36      Points.Name = "Points"
37      Points.Value = 0
38      local MaxHealth = Instance.new("IntValue", stats)
39      MaxHealth.Name = "MaxHealth"
40      MaxHealth.Value = 0
41      local Melee = Instance.new("IntValue", stats)
42      Melee.Name = "Melee"
43      Melee.Value = 0
44      local Speed = Instance.new("NumberValue", stats)
45      Speed.Name = "Sword"
46      Speed.Value = 0
47      local DevilFruit = Instance.new("IntValue", stats)
48      DevilFruit.Name = "DevilFruit"
49      DevilFruit.Value = 0
50      --- Sword
51      local Sword = Instance.new("StringValue", stats)
52      Sword.Name = "SwordOwned"
53      Sword.Value = "None"
54      --- Melee
55      local Melee = Instance.new("StringValue", stats)
56      Melee.Name = "MeleeOwned"
57      Melee.Value = "Combat"
58      --- CurrentBoat
59      local CurrentBoat = Instance.new("StringValue", stats)
60      CurrentBoat.Name = "CurrentBoat"
61      CurrentBoat.Value = "None"
62   
63  end)
64   
65  game.Players.PlayerAdded:Connect(function(Plr)
66      wait(.1)
67      local Exp = Plr.Data.Exp
68      local Levels = Plr.Data.Levels
69      local ExpNeed = Plr.Data.ExpNeed
70      local Points = Plr.Data.Points
71   
72      while wait() do
73              if Exp.Value >= (100 * (Levels.Value + 1)) and Levels.Value <= 399 then
74              Levels.Value = Levels.Value + 1
75              Points.Value = Points.Value + 3
76              Exp.Value = Exp.Value - ExpNeed.Value
77              ExpNeed.Value = ExpNeed.Value + 100
78              game.ReplicatedStorage.LevelSystem.LevelUpGui:FireClient(Plr)
79          end
80      end
81  end)``

~So whats SUPPOSED to happen is you load in at level 1 with zero money (beli) and you need to get 200 exp to level up. This is what happens for me and it works fine.

~However, for my friends, it spawns them in at level 0, they have zero money (beli) and they need to collect 100 exp. The MAIN PROBLEM HOWEVER is that every time they level up they KEEP 100 exp.

------EXAMPLE: Say I am my friend who is level 0 and needs to collect 100 exp. I complete my quest that gives me 100 exp. I should now be at 0/200 exp for my total number of points and level 1. However it makes it so after I level it's 100/200.(if i level again it would be 100/300 if i got another 100 exp). Ik it's confusing im trying but if you have a solution it would be very appreciated. Thx.

0
did you turn studio access to API services on? coolmanHDMI 72 — 4y
0
I'll try that BozzMcBozzington -3 — 4y
0
now what happens in game happens in studio BozzMcBozzington -3 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

This happened to me if you are using team create there is something called collaborative editing when 1 players are editing in the same studio you have to commit your scripts so you would go to view and click on your drafts and commit it so it will work in actual game if this helps please accept

0
I don't got team create active but thx anyways BozzMcBozzington -3 — 4y
0
should i try enabling it and then committing them? Im pretty sure since i've made this alone my scripts are already "committed" in a sense BozzMcBozzington -3 — 4y
Ad

Answer this question