Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I Make When a clickDetector is clicked It will Teleport the Player?

Asked by 2 years ago

I was doing a game about Hangout, But Then I understood something, I was using this script:

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    script.Parent.SurfaceGui.TextLabel.Text = "Has Been Occupied For 8 Minutes"
    script.Parent.ClickDetector:Destroy()
    wait(480)
    script.Parent.SurfaceGui.TextLabel.Text = "Disabled for 30 Seconds"
    wait(30)
    local Clone = game.ReplicatedStorage.ClickDetector
    Clone.Parent = script.Parent
    script.Parent.SurfaceGui.TextLabel.Text = "Waiting For Player..."
    wait(0.1)
    local Clone2 = Instance.new("ClickDetector")
    Clone2.Parent = game.ReplicatedStorage
end)

Then i realised that i needed to use a teleport Script.

2 answers

Log in to vote
0
Answered by 2 years ago

where do you want it to be teleported to please be more specific you can dm me on discord

Blue Duck#8344

Ad
Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

Make a brick then put a click detector and a script in it and in the script write this:

local CD = script.Parent.ClickDetector

CD.MouseClick:connect(function(Player)
    Player.Character:SetPrimaryPartCFrame(CFrame.new(X,Y,Z))
end) 

then change X Y Z to the x y z you want the player to teleport to

Answer this question