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

Will anyone help me with my script??[SOLVED!!!!]

Asked by 10 years ago

So I've already asked to help with this script before, but now there is 1 problem. It works in studio, but it glitches the freak out in a real server. This is the script:

-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
local player = script.Parent.Parent.Parent.Parent
local M = script.Parent
local listbkg = M.ListBkg
local stopp = M.StopPic
local stop = M.Stop
local repb = M.Repeat
local repp = M.RepeatPic
local musicl = M.MusicList
local next = M.Next
local less = M.Less
local more = M.More
local drag = M.Dragger
local dragtext = M.DragText

local musiclist = {}
local musicmodel = script.Parent.Parent.Music
local music = musicmodel:children()
for i,v in pairs(music) do
v.Looped = false
v.PlayOnRemove = false
table.insert(musiclist,v:clone())
end
musicmodel:remove()
local musiclistbuttons = {}
for i,v in pairs(musiclist) do
local ng = Instance.new("TextButton",M)
ng.Position = UDim2.new(0, 0, 0, 20) + UDim2.new(0,0,0,13*i)
ng.Size = UDim2.new(0, 200, 0, 13)
ng.BackgroundTransparency = 1
ng.BackgroundColor3 = Color3.new(0/255,0/255,0/255)
ng.BorderColor3 = Color3.new(255/255,255/255,255/255)
ng.TextColor3 = Color3.new(255/255,255/255,255/255)
ng.Font = "ArialBold"
ng.FontSize = "Size10"
ng.Visible = false
ng.Text = v.Name
ng.Name = v.Name
table.insert(musiclistbuttons,i,ng)
ng.MouseButton1Click:connect(function()
if ng.BackgroundTransparency == 1 then
changesong(musiclist[i])
end
end)

end

listbkg.Size = UDim2.new(0, 120, 0, 20) + UDim2.new(0,0,0,13*#musiclistbuttons)
-----------------------------------------------
-----------------------------------------------

local currentsong = musiclist[1]:clone()
local rep = false
local open = false
local playing = true
local beingdragged = false
local X = M.Position.X.Offset
local Y = M.Position.Y.Offset
local XS = M.Position.X.Scale
local YS = M.Position.Y.Scale

--player.CharacterAdded:wait()

drag.MouseButton1Down:connect(function(mx,my)
beingdragged = true
X = M.Position.X.Offset
Y = M.Position.Y.Offset
XS = M.Position.X.Scale
YS = M.Position.Y.Scale
DposX=mx-X
DposY=my-Y
end)

drag.MouseMoved:connect(function(mx,my)
if beingdragged then
print("Moving")
M.Position=UDim2.new(XS,mx - DposX,YS,my - DposY)
if script.Parent.ColG.Text ~=   "Disco Hangout[1.2]" then M:remove() end
end
end)

drag.MouseButton1Up:connect(function()
beingdragged = false
print("Mouse going up")
if script.Parent.ColG.Text ~= "Disco Hangout[1.2]" then M:remove()   end
end)

drag.MouseLeave:connect(function()
beingdragged = false
dragtext.Visible = false
print("Mouse left")
if   script.Parent.ColG.Text ~= "Disco Hangout[1.2]" then M:remove() end
end)

drag.MouseEnter:connect(function()
dragtext.Visible = true
end)

function checkforstop(song)
while currentsong.IsPlaying do
wait(1)
end
end

function playsong()
checkforstop(currentsong)
print("song stopped")
if playing then 
if rep then
currentsong:play()
playsong(currentsong)
else
for i,v in pairs(musiclist) do
if currentsong.Name == v.Name then
if i == #musiclist then
changesong(musiclist[1])
else
if script.Parent.ColG.Text ~= "Disco Hangout[1.2]" then M:remove() end
changesong(musiclist[i+1])
end
end
end
end
end
end


function changesong(song)
for i,v in pairs(musiclistbuttons) do
if song.Name ~= v.Name then
v.BackgroundTransparency = 1
if script.Parent.ColG.Text ~= "Disco Hangout[1.2]" then M:remove() end
else
v.BackgroundTransparency = 0
end
end

currentsong:stop()
currentsong:remove()
currentsong = song:clone()
currentsong.Parent = M
if playing then
currentsong:play()
playsong(currentsong)
end
end



stop.MouseButton1Click:connect(function()
if playing then
playing = false
stopp.Style = "ChatGreen"
stop.Text = "Play"
currentsong:stop()
else
stopp.Style = "ChatRed"
if script.Parent.ColG.Text ~= "Disco Hangout[1.2]" then M:remove() end
stop.Text = "Stop"
playing = true
currentsong:play()
playsong(currentsong)
end
end)

musicl.MouseButton1Click:connect(function()
for _,v in pairs(musiclistbuttons) do
v.Visible = not v.Visible
end
listbkg.Visible = not listbkg.Visible
end)

repb.MouseButton1Click:connect(function()
repp.Visible = not repp.Visible
rep = not rep
if script.Parent.ColG.Text ~= "Disco Hangout[1.2]" then              M:remove() end
end)

next.MouseButton1Click:connect(function()
for i,v in pairs(musiclist) do
if currentsong.Name == v.Name then
if i == #musiclist then
changesong(musiclist[1])

else
changesong(musiclist[i+1])
end
end
end
end)

less.MouseButton1Click:connect(function()
for _,v in pairs(musiclist) do
if v.Volume >.1 then
v.Volume = v.Volume -.1
end
end
if currentsong.Volume >.1 then
currentsong.Volume = currentsong.Volume -.1
end
end)

more.MouseButton1Click:connect(function()
for _,v in pairs(musiclist) do
if v.Volume <1.2 then
v.Volume = v.Volume +.1
end
end
if currentsong.Volume <1.2 then
currentsong.Volume = currentsong.Volume +.1
end
end)


currentsong.Parent = M
currentsong:play()
musiclistbuttons[1].BackgroundTransparency = 0
playsong(currentsong)

PLEASE HELP ME! THANKS! I will even give 50 robux to the person who helps as gratitude!

1 answer

Log in to vote
1
Answered by 10 years ago

they really need to add comments on the questions.... What is it saying in the Output tab?

0
This: Players.Player1.PlayerGui.Music Player (Place in StarterGui:134: attempt to index local 'song' (a nil value) deputychicken 226 — 10y
0
what is the script supposed to be for? areiydenfan00 115 — 10y
0
Its for a gui music player! deputychicken 226 — 10y
0
Try changing the location of the GUI and script to the starter GUI and make sure your script is a local script. areiydenfan00 115 — 10y
View all comments (7 more)
0
I did. XD deputychicken 226 — 10y
0
Its actually working on studio now its not working properly in the server. deputychicken 226 — 10y
0
check the developer console in game so you can see what is failing areiydenfan00 115 — 10y
0
Ok. deputychicken 226 — 10y
0
It doesn't say anything. But this is what happens: It keeps playing the song and then plays the next song. If you want to see what happens, join my game deputychicken 226 — 10y
0
FIXED IT! YEAH BUDDY! ADDED WAIT TIME FOR REMOVAL :D deputychicken 226 — 10y
0
Glad I could be of assistance.. areiydenfan00 115 — 10y
Ad

Answer this question