JIT
Play button not teleporting after chapter select in script
فيه مشكلة في سكربت ان اذا لاعب ضغط علي الفصل مطلوب(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
Updated files
v1
هل يمكنك صناعة سكربت بدون ملحقات يعني بدون سكربات سيفر فقط سكربت واحد يدي غرض

حسنًا، يمكن دمج الوظائف في سكربت محلي واحد (LocalScript). هذا السكربت سيتعامل مع واجهة المستخدم وسيبدأ عملية الانتقال مباشرة.

ملاحظة: استخدام TeleportService مباشرة من LocalScript ممكن ولكنه أقل أمانًا من استخدام RemoteEvent وخادم للتحقق من الطلبات. قد يكون هذا مناسبًا للألعاب البسيطة، لكن كن حذرًا من إمكانية استغلاله.

كيفية الاستخدام:

  1. احذف السكربتات القديمة (ChapterSelectClient.lua و TeleportServer.lua إذا كانت موجودة).
  2. ضع هذا السكربت الجديد (ChapterSelectCombined.lua) داخل واجهة المستخدم الرسومية الخاصة بك (ScreenGui)، ويفضل أن يكون ابنًا مباشرًا للإطار الرئيسي (frame3) أو ScreenGui نفسها. تأكد من أن المسار في local frame3 = script.Parent صحيح بالنسبة لموقع السكربت.
  3. تأكد من أن أسماء عناصر الواجهة (ImageCH, TITLE, PLAY, CH1, CH2, إلخ) داخل frame3 تتطابق مع ما هو مستخدم في السكربت.
  4. استبدل معرفات الصور (rbxassetid://...) ومعرفات الأماكن (MapID) بالقيم الصحيحة للعبتك.

الآن، عند النقر على زر الفصل ثم زر "PLAY"، سيحاول هذا السكربت المحلي نقل اللاعب مباشرة إلى المكان المحدد.

Updated files
v2