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

How do I prevent someone teleporting to a certain area?

Asked by 5 years ago

I'm trying to make a teleport script with some areas by which the user can't teleport to. However, at the moment, i'm struggling to get the mouse to detect the area by which is blocked from the user so the user ends up teleporting to it.

Debounce = false
local mouse = script.Parent.Parent:GetMouse()

game:GetService('UserInputService').InputBegan:connect(function(input, gameprossed)
if not gameprossed then

  if input.KeyCode == Enum.KeyCode.T and Debounce == false then
    if mouse.Hit.p == ("No").Position then
      print("No teleport")

    else

      Debounce = true

      local ReplicatedStorage = game:GetService("ReplicatedStorage")
      local Teleport = ReplicatedStorage:WaitForChild("Apparate")

      Teleport:FireServer(mouse.Hit.p)

      wait(2)
      Debounce = false
    end
  end
end
end)

There's no errors in output + no print in the output..

Thank you.

0
Can't you just make it where they can click in that area but you place a block with a touched event teleporting them out of that place ontouched? RetroGalacticGamer 331 — 5y
0
so if they try to teleport there they get kicked out RetroGalacticGamer 331 — 5y
0
But that would then defeat the objective of not letting them into certain areas. For example, a room requiring certain assets to access which grants them bonus's in-game. xXTouchOfFrostXx 125 — 5y

Answer this question