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

How does this script work? (music system voting)

Asked by 5 years ago
Edited 5 years ago

This script is a music system voting ?, Try putting music on "ReplicatedStorage" but it does not work, I would like to know what I'm doing wrong.

local info = game.ReplicatedStorage.musicEvents.getSong:InvokeServer()

if info ~= nil then

script.Parent.TextLabel.Text = "Now Playing: " .. info

end

game.ReplicatedStorage.musicEvents.newSong.OnClientEvent:connect(function(song)

script.Parent.TextLabel.Text = "Now Playing: " .. song

script.Parent.Frame:TweenSize(UDim2.new(.5,0,1,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, .2, true)

script.Parent.Parent.opt.down.ImageColor3 = Color3.new(1,1,1)

script.Parent.Parent.opt.up.ImageColor3 = Color3.new(1,1,1)

end)

game.ReplicatedStorage.musicEvents.voteChange.OnClientEvent:connect(function(percent)

script.Parent.Frame:TweenSize(UDim2.new(percent,0,1,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, .2, true)

end)

game.ReplicatedStorage.musicEvents.addSong.OnClientEvent:connect(function()

script.Parent.Parent.add.Visible = true

end)

local selected = nil

script.Parent.Parent:WaitForChild("opt"):WaitForChild("up").MouseEnter:connect(function()

if selected ~= script.Parent.Parent.opt.down then

script.Parent.Parent.opt.down.ImageColor3 = Color3.new(1,1,1)

end

script.Parent.Parent.opt.add.ImageColor3 = Color3.new(1,1,1)

if selected ~= script.Parent.Parent.opt.up then

spawn(function()

for i=1,10 do

script.Parent.Parent.opt.up.ImageColor3 = Color3.new(1 - (i.1),1-((8.5i)/255),1 - (i*.1))

wait()

end

end)

end

end)

script.Parent.Parent.opt.up.MouseLeave:connect(function()

if selected ~= script.Parent.Parent.opt.up then

script.Parent.Parent.opt.up.ImageColor3 = Color3.new(1,1,1)

end

end)

script.Parent.Parent.opt:WaitForChild("down").MouseEnter:connect(function()

if selected ~= script.Parent.Parent.opt.up then

script.Parent.Parent.opt.up.ImageColor3 = Color3.new(1,1,1)

end

script.Parent.Parent.opt.add.ImageColor3 = Color3.new(1,1,1)

if selected ~= script.Parent.Parent.opt.down then

spawn(function()

for i=1,10 do

script.Parent.Parent.opt.down.ImageColor3 = Color3.new(1,1 - (i.1),1 - (i.1))

wait()

end

end)

end

end)

script.Parent.Parent.opt.down.MouseLeave:connect(function()

if selected ~= script.Parent.Parent.opt.down then

script.Parent.Parent.opt.down.ImageColor3 = Color3.new(1,1,1)

end

end)

script.Parent.Parent.opt:WaitForChild("add").MouseEnter:connect(function()

if selected ~= script.Parent.Parent.opt.up then

script.Parent.Parent.opt.up.ImageColor3 = Color3.new(1,1,1)

end

if selected ~= script.Parent.Parent.opt.down then

script.Parent.Parent.opt.down.ImageColor3 = Color3.new(1,1,1)

end

spawn(function()

for i=1,10 do

script.Parent.Parent.opt.add.ImageColor3 = Color3.new(1 - (i.1),1- ((i4.2)/255),1)

wait()

end

end)

end)

script.Parent.Parent.opt.add.MouseLeave:connect(function()

script.Parent.Parent.opt.add.ImageColor3 = Color3.new(1,1,1)

end)

script.Parent.Parent.opt.add.MouseButton1Down:connect(function()

if script.Parent.Parent.add.Visible == false then

script.Parent.Parent.opt.add.ImageColor3 = Color3.new(1,1,1)

game.ReplicatedStorage.musicEvents.purchaseSong:FireServer()

end

end)

script.Parent.Parent.opt.up.MouseButton1Down:connect(function()

game.ReplicatedStorage.musicEvents.voteYes:FireServer()

selected = script.Parent.Parent.opt.up

script.Parent.Parent.opt.up.ImageColor3 = Color3.new(0, 170/255, 0)

end)

script.Parent.Parent.opt.down.MouseButton1Down:connect(function()

game.ReplicatedStorage.musicEvents.voteNo:FireServer()

selected = script.Parent.Parent.opt.down

script.Parent.Parent.opt.down.ImageColor3 = Color3.new(1,0,0)

end)

warn("Music player")

script.Parent.Parent:WaitForChild("add"):WaitForChild("TextButton").MouseButton1Down:connect(function()

if script.Parent.Parent.add.TextBox.Text ~= "" then

game.ReplicatedStorage.musicEvents.addSong:FireServer(script.Parent.Parent.add.TextBox.Text)

script.Parent.Parent.add.Visible = false

end

end)

Answer this question