Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is there any errors in the Escape Pod Script or it is model glitch?

(Sorry for my bad English) Hello. I tried to make SpaceShip Escape Pods that will make player teleport to other game. I made pod model but in it, I couldn't make escape script that must do: Close door + teleport player to another game. It haven't worked inside pod but if I was out, it worked but player was outside pod. Here's my model parts screenshot: https://imgur.com/a/ayt4xXv

Here is the script I used:

local Part = script.Parent
local CD = Part.ClickDetector
local GameId = 331811267
	
CD.MouseClick:connect(function(Player)
	script.Parent.Parent.DoorC.Transparency = 0
	script.Parent.Parent.DoorC.CanCollide = true
	script.Parent.Parent.DoorO.Transparency = 1
	script.Parent.Parent.DoorO.CanCollide = false
	game:GetService('TeleportService'):Teleport(GameId, Player)
	end)

Is there any errors in the script or it is model glitch? What I doing wrong?

3 comments

0

Set an if statement checking if they are near a part in the pod model?

0

Oh. Okay. Thanks

0

could you accept my answer if it works'\

1 answer

if you click the part:

local Part = script.Parent.Parent
local CD = Part.ClickDetector
local GameId = 331811267

CD.MouseClick:connect(function(Player)
    script.Parent.Parent.DoorC.Transparency = 0
    script.Parent.Parent.DoorC.CanCollide = true
    script.Parent.Parent.DoorO.Transparency = 1
    script.Parent.Parent.DoorO.CanCollide = false
    game:GetService('TeleportService'):Teleport(GameId, Player)
    end)

script.parent.parent is the part

if you click the button surface gui (local script)

local Button = script.Parent
local GameId = 331811267

Button.MouseButton1Click:connect(function()
local player = game.Players.LocalPlayer
    script.Parent.Parent.DoorC.Transparency = 0
    script.Parent.Parent.DoorC.CanCollide = true
    script.Parent.Parent.DoorO.Transparency = 1
    script.Parent.Parent.DoorO.CanCollide = false
    game:GetService('TeleportService'):Teleport(GameId, Player)
    end)

The problem: you can't do click the detect for a button or you forgot a .Parent

script 1 is for the click detector

script 2 is for the button surface gui (make it a local script)

7 comments

0

Thank you very much.

0

coukd ou accept if it works

0

accept what? I am just new here

0

the answer

0

How to accept answer? ;-; Also it not work

0

oh ok'

0

Anyway, you helped me.

This discussion is preserved as it was. New answers, comments, and votes are closed.