generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Sound play

Previous Thread :: Next Thread 
JonathanW123 is not online. JonathanW123
Joined: 04 Apr 2012
Total Posts: 5832
10 Jul 2015 09:08 PM
HOW TO MAKE IT SO THAT THE SOUND PLAYS AS THE LEVEL GUI TWEENSIVE MOVES
I WANT IT TO PLAY http://www.roblox.com/sfx-die-item?id=145486927

local Stats = game.Players.LocalPlayer:WaitForChild("leaderstat")
local StatsServer = game.ReplicatedStorage:WaitForChild("Stats")

script.Parent.Frame:TweenSize(UDim2.new(Stats.CurrentXP.Value/(100), 0, 1, 0), "Out", "Linear", .2, true)
script.Parent.TextLabel.Text = "Current Level: "..Stats.Level.Value.." || Level Progress: "..math.ceil(Stats.CurrentXP.Value).."%"

if Stats.CurrentXP.Value >= 100 then
local Extra = Stats.CurrentXP.Value - 100
script.Parent.Frame:TweenSize(UDim2.new(0, 0, 1, 0), "Out", "Linear", 0.2, true)
wait(0.2)
StatsServer:FireServer("UpdateLevel")
StatsServer:FireServer("UpdateXP", Extra)
-- Update instantly, Even thought the Changed will fire again. It's better for instant results.
-- (Latency may stop instant update)
script.Parent.Frame:TweenSize(UDim2.new(Extra/(100), 0, 1, 0), "Out", "Linear", 0.2, true)
script.Parent.TextLabel.Text = "Current Level: "..Stats.Level.Value.." || Level Progress: "..math.ceil(Stats.CurrentXP.Value).."%"
end

Stats.CurrentXP.Changed:connect(function()
if Stats.CurrentXP.Value >= 100 then
local Extra = Stats.CurrentXP.Value - 100
script.Parent.Frame:TweenSize(UDim2.new(0, 0, 1, 0), "Out", "Linear", 0.2, true)
wait(0.2)
StatsServer:FireServer("UpdateLevel")
StatsServer:FireServer("UpdateXP", Extra)
-- Update instantly, Even thought the Changed will fire again. It's better for instant results.
-- (Latency may stop instant update)
script.Parent.Frame:TweenSize(UDim2.new(Extra%100/(100), 0, 1, 0), "Out", "Linear", 0.2, true)
script.Parent.TextLabel.Text = "Current Level: "..Stats.Level.Value.." || Level Progress: "..math.ceil(Stats.CurrentXP.Value).."%"
else
script.Parent.Frame:TweenSize(UDim2.new(Stats.CurrentXP.Value/(100), 0, 1, 0), "Out", "Linear", .2, true)
script.Parent.TextLabel.Text = "Current Level: "..Stats.Level.Value.." || Level Progress: "..math.ceil(Stats.CurrentXP.Value).."%"
end
end)
Report Abuse
JonathanW123 is not online. JonathanW123
Joined: 04 Apr 2012
Total Posts: 5832
10 Jul 2015 09:10 PM
b1


I'm just here so I don't get fined
Report Abuse
DigitalVeer is not online. DigitalVeer
Joined: 23 Jun 2009
Total Posts: 4182
10 Jul 2015 09:15 PM
local Stats = game.Players.LocalPlayer:WaitForChild("leaderstat")
local StatsServer = game.ReplicatedStorage:WaitForChild("Stats")
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://145486927"
sound.Parent = script.Parent

script.Parent.Frame:TweenSize(UDim2.new(Stats.CurrentXP.Value/(100), 0, 1, 0), "Out", "Linear", .2, true)
script.Parent.TextLabel.Text = "Current Level: "..Stats.Level.Value.." || Level Progress: "..math.ceil(Stats.CurrentXP.Value).."%"

if Stats.CurrentXP.Value >= 100 then
local Extra = Stats.CurrentXP.Value - 100
script.Parent.Frame:TweenSize(UDim2.new(0, 0, 1, 0), "Out", "Linear", 0.2, true)
wait(0.2)
StatsServer:FireServer("UpdateLevel")
StatsServer:FireServer("UpdateXP", Extra)
-- Update instantly, Even thought the Changed will fire again. It's better for instant results.
-- (Latency may stop instant update)
script.Parent.Frame:TweenSize(UDim2.new(Extra/(100), 0, 1, 0), "Out", "Linear", 0.2, true)
script.Parent.TextLabel.Text = "Current Level: "..Stats.Level.Value.." || Level Progress: "..math.ceil(Stats.CurrentXP.Value).."%"
end

Stats.CurrentXP.Changed:connect(function()
sound:Play()
if Stats.CurrentXP.Value >= 100 then
local Extra = Stats.CurrentXP.Value - 100
script.Parent.Frame:TweenSize(UDim2.new(0, 0, 1, 0), "Out", "Linear", 0.2, true)
wait(0.2)
StatsServer:FireServer("UpdateLevel")
StatsServer:FireServer("UpdateXP", Extra)
-- Update instantly, Even thought the Changed will fire again. It's better for instant results.
-- (Latency may stop instant update)
script.Parent.Frame:TweenSize(UDim2.new(Extra%100/(100), 0, 1, 0), "Out", "Linear", 0.2, true)
script.Parent.TextLabel.Text = "Current Level: "..Stats.Level.Value.." || Level Progress: "..math.ceil(Stats.CurrentXP.Value).."%"
else
script.Parent.Frame:TweenSize(UDim2.new(Stats.CurrentXP.Value/(100), 0, 1, 0), "Out", "Linear", .2, true)
script.Parent.TextLabel.Text = "Current Level: "..Stats.Level.Value.." || Level Progress: "..math.ceil(Stats.CurrentXP.Value).."%"
end
end)
Report Abuse
JonathanW123 is not online. JonathanW123
Joined: 04 Apr 2012
Total Posts: 5832
10 Jul 2015 09:16 PM
wow perfect person huh


I'm just here so I don't get fined
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image