This script controls the level for the player, and when they level up, Golden text shows up that says "Level Up!" and a sound plays. However, it only plays in studio mode, and I cant get it to play in normal mode. People have told me to use PreLoad(), but I can't get it to work.
(this is not a local script, it is a normal script inside of starterpack)
s = script.Parent
p = s.Parent
c = p.Character
Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=11597751")
p.Levelss.XP.Changed:connect(function()
if p.Levelss.XP.Value >= p.Levelss.Level.Value * 20 then
p.Levelss.XP.Value = 0
p.Levelss.Level.Value = p.Levelss.Level.Value + 1
p.Character.Humanoid.MaxHealth = p.Character.Humanoid.MaxHealth + 10
p.Character.Humanoid.Health = p.Character.Humanoid.Health + 10
p.Levelss.FAP.Value = p.Levelss.FAP.Value + 1
p.PlayerGui.ScreenGui.LevelUpSound:play()
p.PlayerGui.ScreenGui.LevelUp.TextLevel.Visible = true
wait(5)
p.PlayerGui.ScreenGui.LevelUp.TextLevel.Visible = false
end
end)
c.Humanoid.MaxHealth = p.Levelss.Level.Value * 10 + 100
c.Humanoid.Health = p.Levelss.Level.Value * 10 + 100

2 comments
I have also tried to make it "https://"
This needs to be a local script, https://gyazo.com/486e7d678d9b14cf7e865880492fc419