It works in studio, but not in game.
I have a set of drums commonly found in free models. I decided I wanted to convert them into FE for my group. The problem is the GUI will not even appear to choose the song to play.
I believe it may be the third line in the script in the GUI
Local Script
wait(.2)
local tool=script.Parent
local weld33 = nil -- right arm
local player = game.Players.LocalPlayer;
local welds = {}
local arms = nil
local torso = nil
function playAllNear()
local list={}
for i,v in pairs(game.Players:children()) do
if v:IsA("Player") then
if v.Character~=nil then
local ptc=v.Character:findFirstChild("Torso")
if torso and ptc then
print((torso.Position-ptc.Position).magnitude)
if (torso.Position-ptc.Position).magnitude<20 then
local l=v.Character:findFirstChild("Drum")
if not l then l=v.Character:findFirstChild("Fife") end
if l then
if l.SyncPlay.Value==true then
print("done!")
list[#list+1]=l
end
end
end
end
end
end
end
return list
end
function updateSong()
tool.ShowGui.Value=false
for i,v in pairs(tool.Handle:children()) do
if v:IsA("Sound") then v:stop() end
end
if not tool.Handle:findFirstChild(tool.Playing.Value) then
tool.Playing.Value=""
end
if tool.Playing.Value=="" then
weld88.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
weld99.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
else
if tool.SyncPlay.Value==true then
if tool.SyncPlay.Value==true then
local li=playAllNear()
for i,v in pairs(li) do
v.Playing.Value=tool.Playing.Value
end
end
end
tool.Handle:findFirstChild(tool.Playing.Value):play()
while tool.Playing.Value~="" do
wait()
weld55.C1 = CFrame.new(1.2, 0, 0.4) * CFrame.Angles(math.rad(-80), math.rad(0), math.rad(0))
weld33.C1 = CFrame.new(-1.2, 0, 0.4) * CFrame.Angles(math.rad(-60), math.rad(-40), math.rad(0))
weld88.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(30), math.rad(0))
weld99.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(30), math.rad(0))
wait()
weld55.C1 = CFrame.new(1.2, 0, 0.4) * CFrame.Angles(math.rad(-75), math.rad(0), math.rad(0))
weld33.C1 = CFrame.new(-1.2, 0, 0.4) * CFrame.Angles(math.rad(-65), math.rad(-40), math.rad(0))
weld88.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(15), math.rad(0))
weld99.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(15), math.rad(0))
wait()
weld55.C1 = CFrame.new(1.2, 0, 0.4) * CFrame.Angles(math.rad(-65), math.rad(0), math.rad(0))
weld33.C1 = CFrame.new(-1.2, 0, 0.4) * CFrame.Angles(math.rad(-75), math.rad(-40), math.rad(0))
weld88.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
weld99.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
wait()
weld55.C1 = CFrame.new(1.2, 0, 0.4) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))
weld33.C1 = CFrame.new(-1.2, 0, 0.4) * CFrame.Angles(math.rad(-80), math.rad(-40), math.rad(0))
weld88.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(-15), math.rad(0))
weld99.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(-15), math.rad(0))
wait()
weld55.C1 = CFrame.new(1.2, 0, 0.4) * CFrame.Angles(math.rad(-65), math.rad(0), math.rad(0))
weld33.C1 = CFrame.new(-1.2, 0, 0.4) * CFrame.Angles(math.rad(-75), math.rad(-40), math.rad(0))
weld88.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(-30), math.rad(0))
weld99.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(-30), math.rad(0))
wait()
weld55.C1 = CFrame.new(1.2, 0, 0.4) * CFrame.Angles(math.rad(-75), math.rad(0), math.rad(0))
weld33.C1 = CFrame.new(-1.2, 0, 0.4) * CFrame.Angles(math.rad(-65), math.rad(-40), math.rad(0))
weld88.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(-15), math.rad(0))
weld99.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(-15), math.rad(0))
wait()
weld55.C1 = CFrame.new(1.2, 0, 0.4) * CFrame.Angles(math.rad(-77), math.rad(0), math.rad(0))
weld33.C1 = CFrame.new(-1.2, 0, 0.4) * CFrame.Angles(math.rad(-62), math.rad(-40), math.rad(0))
weld88.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
weld99.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
wait()
weld55.C1 = CFrame.new(1.2, 0, 0.4) * CFrame.Angles(math.rad(-80), math.rad(0), math.rad(0))
weld33.C1 = CFrame.new(-1.2, 0, 0.4) * CFrame.Angles(math.rad(-60), math.rad(-40), math.rad(0))
weld88.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(15), math.rad(0))
weld99.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(15), math.rad(0))
end
end
end
function leftClick(mouse)
if tool.Playing.Value=="" then
tool.ShowGui.Value=not tool.ShowGui.Value
end
if tool.Playing.Value~="" then
tool.Playing.Value=""
end
end
function onEquippedLocal(mouse)
if mouse == nil then
return
end
if (player~=nil) then
game.ReplicatedStorage.MusicEq:FireServer(tool)
end
-- mouse.Icon = "rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function() leftClick(mouse) end)
while true do
wait()
end
end
function onUnequippedLocal(mouse)
game.ReplicatedStorage.MusicUneq:FireServer()
end
st=0
tool.Playing.Value=""
function Equip(mouse)
wait(0.01)
local Player = game.Players.LocalPlayer
Player.Character.Humanoid.JumpPower = 0
arms = {tool.Parent:FindFirstChild("Left Arm"), tool.Parent:FindFirstChild("Right Arm")}
torso = tool.Parent:FindFirstChild("Torso")
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = nil
sh[2].Part1 = nil
local weld1 = Instance.new("Weld") -- left arm
weld55 = weld1
weld1.Part0 = torso
weld1.Parent = torso
weld1.Part1 = arms[1]
weld1.C1 = CFrame.new(1.2, 0, 0.4) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))
welds[1] = weld1
local weld2 = Instance.new("Weld") -- right arm
weld33 = weld2
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C1 = CFrame.new(-1.2, 0, 0.4) * CFrame.Angles(math.rad(-60), math.rad(-40), math.rad(0))
welds[2] = weld2
local weld3 = Instance.new("Weld") -- right arm
local weld77 = weld3
weld3.Part0 = torso
weld3.Parent = torso
weld3.Part1 = tool.Handle
weld3.C1 = CFrame.new(1.2, -1, -.5) * CFrame.Angles(math.rad(90),math.rad(0),math.rad(-90))
welds[3] = weld3
local weldL = Instance.new("Weld") -- Left drum stick
weld88=weldL
weldL.Part0 = arms[1]
weldL.Parent = arms[1]
weldL.Part1 = tool.LDrumStick
weldL.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
welds[4] = weldL
local weldR = Instance.new("Weld") -- Right drum stick
weld99=weldR
weldR.Part0 = arms[2]
weldR.Parent = arms[2]
weldR.Part1 = tool.RDrumStick
weldR.C1 = CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
welds[5] = weldR
end
else
end
else
end
end
function Unequip(mouse)
local Player = game.Players.LocalPlayer
Player.Character.Humanoid.JumpPower = 35
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = arms[1]
sh[2].Part1 = arms[2]
welds[1].Parent = nil
welds[2].Parent = nil
welds[3].Parent = nil
welds[4].Parent = nil
welds[5].Parent = nil
end
else
end
else
end
end
tool.Unequipped:connect(onUnequippedLocal)
tool.Equipped:connect(onEquippedLocal)
tool.Playing.Changed:connect(updateSong)
tool.Equipped:connect(Equip)
tool.Unequipped:connect(Unequip)
Script
game.ReplicatedStorage.MusicEq.OnServerEvent:connect(function(Player, tool)
Player.PlayerGui.DrumGui.Tool.Value=tool
Player.PlayerGui.DrumGui.Enabled = true
end)
game.ReplicatedStorage.MusicUneq.OnServerEvent:connect(function(Player)
if (Player:findFirstChild("PlayerGui"):findFirstChild("DrumGui")) then
Player.PlayerGui.DrumGui.Enabled = false
end
end)
Script in GUI
wait(.2)
g=script.Parent
repeat wait() until g.Tool.Value
tool=g.Tool.Value
local l=nil
if tool.SyncPlay.Value==true then
l="Yes"
else
l="No"
end
g.List.Sync.Text="Syncronised Play: "..l
tool.Playing.Changed:connect(function()
if tool.Playing.Value=="" then
g.MainFrame.Info.Text="Left click"
else
g.MainFrame.Info.Text=tool.Playing.Value
end
end)
tool.ShowGui.Changed:connect(function()
g.List.Visible=tool.ShowGui.Value
end)
tool.SyncPlay.Changed:connect(function()
local l=nil
if tool.SyncPlay.Value==true then
l="Yes"
else
l="No"
end
g.List.Sync.Text="Syncronised Play: "..l
end)
g.List.Sync.MouseButton1Down:connect(function()
tool.SyncPlay.Value=not tool.SyncPlay.Value
end)
for i,v in pairs(g.List:children()) do
if v~=g.List.Sync then
if v:IsA("TextButton") then
v.MouseButton1Down:connect(function()
tool.Playing.Value=v.Name
end)
end
end
end

4 comments
Regular scripts don't work in StarterGui. In other words, the client can't make changes to the server with FilteringEnabled on without RemoteEvents, RemoteFunctions, etc.
This is not free model help site. Please make an attempt.
I certainly did make an attempt, I edited the code to the point where it worked in studio. I was just having an issue where the GUI wouldn't display. I even pointed out where I thought the error may be. I wanted a reason. I got my reason. Read a post thoroughly before judging it.
Too broad of a question, and it's not constructive seeing as this is an FM. Narrow the issue down rather than posting 200+ lines of code for us to decipher.