Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I use PreLoad() for this sound?

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

0

I have also tried to make it "https://"

1

This needs to be a local script, https://gyazo.com/486e7d678d9b14cf7e865880492fc419

1 answer

Assets = {} --Enter Audio ID that needs preloading.
 
for _, asset in ipairs(Assets) do
     Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=" .. asset)

end

If that did not work, please try using wait lines e.x.

wait(5)

This discussion is preserved as it was. New answers, comments, and votes are closed.