فيه مشكلة في سكربت ان اذا لاعب ضغط علي الفصل مطلوب(CH) و ضغط علي زر PLAY لا يمعل نقل local frame3 = script.Parent
local imageCH = frame3:FindFirstChild("ImageCH")
local title = frame3:FindFirstChild("TITLE")
local selectedChapter = nil
local soundId = "rbxassetid://9083627113"
local soundVolume = 10
local chapterImages = {
["CH1"] = "rbxassetid://100580840836836", -- Replace with actual image asset ID
["CH2"] = "rbxassetid://99147170541641",
["CH3"] = "rbxassetid://0",
["CH4"] = "rbxassetid://0",
["CH5"] = "rbxassetid://0"
}
local chapterTitles = {
["CH1"] = "القبو",
["CH2"] = "المستشفى",
["CH3"] = "المخيم",
["CH4"] = "مكتب شرطة",
["CH5"] = "العالم الآخر"
}
local chapterMapIDs = {
["CH1"] = 124171691544780, -- Replace with actual map ID
["CH2"] = 98856503561955,
["CH3"] = 0,
["CH4"] = 0,
["CH5"] = 0
}
local function playSound()
local sound = Instance.new("Sound")
sound.SoundId = soundId
sound.Volume = soundVolume
sound.Parent = game.Workspace
sound:Play()
end
local function deleteStaticScript()
local staticScript = game.Workspace:FindFirstChild("static script")
if staticScript then
staticScript:Destroy()
end
end
-- Add function to handle chapter selection and map teleportation
for chapterName, imageId in pairs(chapterImages) do
local button = frame3:FindFirstChild(chapterName)
if button then
button.MouseButton1Click:Connect(function()
-- Update image and title
if imageCH then
imageCH.Image = imageId
end
if title then
title.Text = chapterTitles[chapterName]
end
selectedChapter = chapterName
playSound()
deleteStaticScript()
end)
end
end
-- Handle "PLAY" button click
local playButton = frame3:FindFirstChild("PLAY")
if playButton then
playButton.MouseButton1Click:Connect(function()
if selectedChapter then
local mapID = chapterMapIDs[selectedChapter]
if mapID and mapID > 0 then
game.ReplicatedStorage:WaitForChild("TeleportToMap"):FireServer(mapID)
playSound() -- Optionally, play sound when teleporting
end
end
end)
end