You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to achieve a working map picker system. How the system works is that once a player click a specific button, the script will add the maps on a specific folder. Players can choose the maps by clicking next and previous.
What is the issue? Include screenshots / videos if possible!
What solutions have you tried so far?
So far I tried GetPropertyChangedSignal and Changed function and still need to find another solution
local easy = game.Workspace.Buttons.Easy_Button
local medium = game.Workspace.Buttons.Medium_Button
local sin1 = game.Workspace.Buttons.SingleNext_1
local sin2 = game.Workspace.Buttons.SinglePrev_1
local back3 = game.Workspace.Buttons.Back3
local player = game.Players.LocalPlayer
for _,v in pairs(workspace.Maps:GetChildren()) do
local template = game.Workspace.MapPlaceholder1
local playbutton = game.Workspace.Buttons.JoinButton_1
finished = nil
local num = 1
local maps = game.Workspace.Maps
local function getDectector(button, difficulty)
local limit = script.Limits[difficulty]
local child = game.Workspace.Maps[difficulty]:GetChildren()
limit.Value = #child
local str = script.Sin
button.ClickDetector.MouseClick:Connect(function(plr) -- Map add when press a specific button
if v:IsA("Folder") then
if v.Name == difficulty then
str.Value = difficulty
if limit.Value == 1 then
sin1.ClickDetector.MaxActivationDistance = 0
sin2.ClickDetector.MaxActivationDistance = 0
sin1.Transparency = 1
sin2.Transparency = 1
else
sin1.ClickDetector.MaxActivationDistance = 10000
sin2.ClickDetector.MaxActivationDistance = 10000
sin1.Transparency = 0.5
sin2.Transparency = 0.5
end
template.Creator.SurfaceGui.SIGN.Text = "By: "..v[num].Creator.Value
template.MapDifficulty.SurfaceGui.SIGN.Text = v[num].Difficulty.Value
template.MapImage.Decal.Texture = v[num].MapImage.Texture
template.MapName.SurfaceGui.SIGN.Text = v[num].MapName.Value
template.TotalRooms.SurfaceGui.SIGN.Text = v[num].TotalRooms.Value.." Rooms"
playbutton.JoinValue.Value = v[num].PlayID.Value
end
end
end)
sin1.ClickDetector.MouseClick:Connect(function(plr) -- Preview Next
if v:IsA("Folder") then
str:GetPropertyChangedSignal("Value"):Connect(function()
if v.Name == str.Value then
num = num +1
if num > limit.Value then
num = 1
end
template.Creator.SurfaceGui.SIGN.Text = "By: "..v[num].Creator.Value
template.MapDifficulty.SurfaceGui.SIGN.Text = v[num].Difficulty.Value
template.MapImage.Decal.Texture = v[num].MapImage.Texture
template.MapName.SurfaceGui.SIGN.Text = v[num].MapName.Value
template.TotalRooms.SurfaceGui.SIGN.Text = v[num].TotalRooms.Value.." Rooms"
playbutton.JoinValue.Value = v[num].PlayID.Value
end
end)
end
end)
sin2.ClickDetector.MouseClick:Connect(function(plr) -- Preview Previous
if v:IsA("Folder") then
str:GetPropertyChangedSignal("Value"):Connect(function()
if v.Name == str.Value then
num = num -1
if num < 1 then
num = limit.Value
end
template.Creator.SurfaceGui.SIGN.Text = "By: "..v[num].Creator.Value
template.MapDifficulty.SurfaceGui.SIGN.Text = v[num].Difficulty.Value
template.MapImage.Decal.Texture = v[num].MapImage.Texture
template.MapName.SurfaceGui.SIGN.Text = v[num].MapName.Value
template.TotalRooms.SurfaceGui.SIGN.Text = v[num].TotalRooms.Value.." Rooms"
playbutton.JoinValue.Value = v[num].PlayID.Value
end
end)
end
end)
return button, difficulty
end
back3.ClickDetector.MouseClick:Connect(function()
num = 1
end)
getDectector(easy, "Easy")
getDectector(medium, "Medium")
end
I found a issue for your script It check if 3 is in your map or not:
local easy = game.Workspace.Buttons.Easy_Button
local medium = game.Workspace.Buttons.Medium_Button
local sin1 = game.Workspace.Buttons.SingleNext_1
local sin2 = game.Workspace.Buttons.SinglePrev_1
local back3 = game.Workspace.Buttons.Back3
local player = game.Players.LocalPlayer
for _,v in pairs(workspace.Maps:GetChildren()) do
local template = game.Workspace.MapPlaceholder1
local playbutton = game.Workspace.Buttons.JoinButton_1
finished = nil
local num = 1
local maps = game.Workspace.Maps
local function getDectector(button, difficulty)
local limit = script.Limits[difficulty]
local child = game.Workspace.Maps[difficulty]:GetChildren()
limit.Value = #child
local str = script.Sin
button.ClickDetector.MouseClick:Connect(function(plr) -- Map add when press a specific button
if v:IsA("Folder") then
if v.Name == difficulty and (v:FindFirstChild(num) or v:FindFirstChild(tostring(num))) then
str.Value = difficulty
if limit.Value == 1 then
sin1.ClickDetector.MaxActivationDistance = 0
sin2.ClickDetector.MaxActivationDistance = 0
sin1.Transparency = 1
sin2.Transparency = 1
else
sin1.ClickDetector.MaxActivationDistance = 10000
sin2.ClickDetector.MaxActivationDistance = 10000
sin1.Transparency = 0.5
sin2.Transparency = 0.5
end
template.Creator.SurfaceGui.SIGN.Text = "By: "..v[num].Creator.Value
template.MapDifficulty.SurfaceGui.SIGN.Text = v[num].Difficulty.Value
template.MapImage.Decal.Texture = v[num].MapImage.Texture
template.MapName.SurfaceGui.SIGN.Text = v[num].MapName.Value
template.TotalRooms.SurfaceGui.SIGN.Text = v[num].TotalRooms.Value.." Rooms"
playbutton.JoinValue.Value = v[num].PlayID.Value
end
end
end)
sin1.ClickDetector.MouseClick:Connect(function(plr) -- Preview Next
if v:IsA("Folder") then
str:GetPropertyChangedSignal("Value"):Connect(function()
if v.Name == str.Value and (v:FindFirstChild(num) or v:FindFirstChild(tostring(num))) then
num = num +1
if num > limit.Value then
num = 1
end
template.Creator.SurfaceGui.SIGN.Text = "By: "..v[num].Creator.Value
template.MapDifficulty.SurfaceGui.SIGN.Text = v[num].Difficulty.Value
template.MapImage.Decal.Texture = v[num].MapImage.Texture
template.MapName.SurfaceGui.SIGN.Text = v[num].MapName.Value
template.TotalRooms.SurfaceGui.SIGN.Text = v[num].TotalRooms.Value.." Rooms"
playbutton.JoinValue.Value = v[num].PlayID.Value
end
end)
end
end)
sin2.ClickDetector.MouseClick:Connect(function(plr) -- Preview Previous
if v:IsA("Folder") then
str:GetPropertyChangedSignal("Value"):Connect(function()
if v.Name == str.Value and (v:FindFirstChild(num) or v:FindFirstChild(tostring(num))) then
num = num -1
if num < 1 then
num = limit.Value
end
template.Creator.SurfaceGui.SIGN.Text = "By: "..v[num].Creator.Value
template.MapDifficulty.SurfaceGui.SIGN.Text = v[num].Difficulty.Value
template.MapImage.Decal.Texture = v[num].MapImage.Texture
template.MapName.SurfaceGui.SIGN.Text = v[num].MapName.Value
template.TotalRooms.SurfaceGui.SIGN.Text = v[num].TotalRooms.Value.." Rooms"
playbutton.JoinValue.Value = v[num].PlayID.Value
end
end)
end
end)
return button, difficulty
end
back3.ClickDetector.MouseClick:Connect(function()
num = 1
end)
getDectector(easy, "Easy")
getDectector(medium, "Medium")
end
I just realize I actually put the next and previous button functions in a local function instead of putting them outside which cause the script to break.