|
| 01 Mar 2015 05:11 AM |
With the last roblox studio update, none of the scripts I putted in the workspace are working. I tried to redo them but that makes no sense. For example, here is the code to make the leaderstats:
function onXPChanged(player, XP, level) if XP.Value>=player.leaderstats.Lvl.Value * 50 then XP.Value = XP.Value - player.leaderstats.Lvl.Value * 50 player.leaderstats.Lvl.Value = player.leaderstats.Lvl.Value + 1 local dmg = player.leaderstats.Lvl.Value + dmg end end
function onLevelUp(player, XP, level) if player.Character~=nil and level.Value + 1 then for i = 1,5 do local fireworks = Instance.new("Part") fireworks.Shape = "Ball" fireworks.formFactor = "Symmetric" fireworks.Transparency = 0.5 fireworks.Size = Vector3.new(2,2,2) fireworks.BrickColor = BrickColor.Random() fireworks.CFrame = player.Character.Head.CFrame + Vector3.new(0,2,0) fireworks.Parent = game.Workspace game:GetService("Debris"):AddItem(fireworks, 2) fireworks.Velocity = Vector3.new(math.random(-30,30),math.random(-30,30),math.random(-30,30)) player.Character.Humanoid.MaxHealth = player.Character.Humanoid.MaxHealth + 50 player.Character.Humanoid.Health = player.Character.Humanoid.Health + 50 end end local m = Instance.new("Hint") m.Parent = game.Workspace m.Text = player.Name .. " Level has been updated, Congratulations!" wait(5) m.Parent = nil end --Optional remove line 23 to 28 if a message when someone levels up is unwanted. To edit message change whats between the "s--
function onPlayerRespawned(player) wait(5) player.Character.Humanoid.MaxHealth = player.leaderstats.Lvl.Value * 50 + 50 player.Character.Humanoid.Health = player.leaderstats.Lvl.Value * 50 + 50 --[[ local stuff = player.Backpack:GetChildren() wait(5) for i = 1,#stuff do local name = stuff[i].Name if game.Starterpack:findFirstChild(name)==nil then stuff[i]:Clone().Parent = player.Backpack end end --]] end
function onPlayerEntered(newPlayer) local stats = Instance.new("IntValue") stats.Name = "leaderstats"
local level = Instance.new("IntValue") level.Name = "Lvl" level.Value = 1
local xp = Instance.new("IntValue") xp.Name = "XP" xp.Value = 0
local gold = Instance.new("IntValue") gold.Name = "Gold" gold.Value = 0 level.Parent = stats xp.Parent = stats gold.Parent = stats
stats.Parent = newPlayer
xp.Changed:connect(function() onXPChanged(newPlayer, xp, level) end) level.Changed:connect(function() onLevelUp(newPlayer, xp, level) end)
newPlayer.Changed:connect(function (property) if (property == "Character") and player.Character then onPlayerRespawned(newPlayer) end end) end
game.Players.ChildAdded:connect(onPlayerEntered)
I'm 100% sure this code is good, because it worked before. Please tell me what to do or how to avoid this. |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2015 05:12 AM |
| I pasted the whole script, sorry. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 01 Mar 2015 05:34 AM |
game.Players.PlayerAdded:connect(function(player) coroutine.resume(coroutine.create(function() local stats = Instance.new("Folder",player) stats.Name = "leaderstats" local level = Instance.new("IntValue",stats) level.Name = "Lvl" level.Value = 1 local xp = Instance.new("IntValue",stats) xp.Name = "XP" xp.Value = 0 local gold = Instance.new("IntValue",stats) gold.Name = "Gold" gold.Value = 0 player.CharacterAdded:connect(function(char) local human = char:WaitForChild("Humanoid") human.MaxHealth = (level.Value * 50) + 50 wait() human.Health = human.MaxHealth xp.Changed:connect(function() if xp.Value >= ((level.Value + (level.Value + 100)) * 2) then -- just change that to whatever formula you like level.Value = level.Value + 1 human.MaxHealth = (level.Value * 50) + 50 wait() human.Health = human.MaxHealth for i = 1,5 do local fireworks = Instance.new("Part") fireworks.Shape = "Ball" fireworks.formFactor = "Symmetric" fireworks.Transparency = 0.5 fireworks.Size = Vector3.new(2,2,2) fireworks.BrickColor = BrickColor.Random() fireworks.CFrame = char:WaitForChild("Head").CFrame + Vector3.new(0,2,0) fireworks.Parent = game.Workspace game.Debris:AddItem(fireworks, 2) fireworks.Velocity = Vector3.new(math.random(-30,30),math.random(-30,30),math.random(-30,30)) end local m = Instance.new("Hint") m.Parent = game.Workspace m.Text = player.Name .. " Level has been updated, Congratulations!" game.Debris:AddItem(m,5) end end) end) end)) end) |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2015 05:58 AM |
| That makes no sense. You made the level up script only work when a player joins. Also the leaderboard still doesn't load. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 01 Mar 2015 06:01 AM |
| the script works fine dude |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2015 06:12 AM |
| Come in my game and try it. If it works fine by you, it is a bug. |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2015 06:13 AM |
| I wouldn't say it doesn't work if it did |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 01 Mar 2015 06:41 AM |
http://www.roblox.com/Donate-Gui-place?id=221446609
you are obviously using it wrong |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2015 06:43 AM |
Chimmihc, trust me:
This script worked before. I had no problems untill the last Roblox Studio update. I didn't change anything, but it is not working. So please don't say I use it wrong. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
| |
|
|
| 01 Mar 2015 07:02 AM |
| Go to this place and you know what I mean |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2015 07:02 AM |
| http://www.roblox.com/RPG-place?id=135945874 |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2015 09:49 AM |
| I'll try making another game and then copy all the scripts to see if that works |
|
|
| Report Abuse |
|
|