Advertisement
DaDogeDevelopment

Teleport

Nov 22nd, 2022 (edited)
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. TeleportScript (TeleportButton)
  2. LocalScript (TeleportFrame)
  3. LocalScript2 (TeleportButton inside of teleportframe)
  4. Teleport (RS)
  5.  
  6. TeleportScript:
  7. local Teleport = script.Parent.Parent.TeleportButton
  8. local frame = script.Parent.TeleportFrame
  9.  
  10. Teleport.MouseButton1Click:Connect(function()
  11.     frame.Visible = true
  12. end)
  13.  
  14. LocalScript:
  15. game.ReplicatedStorage.Teleport.OnClientEvent:Connect(function(plr, name)
  16.     plr.Character.HumanoidRootPart.CFrame = game.Players:FindFirstChild(name).Character.Head
  17. end)
  18.  
  19. LocalScript2:
  20. script.Parent.MouseButton1Click:Connect(function()
  21.     if game.Players:FindFirstChild(script.Parent.Parent.Username.Text) then
  22.         game.ReplicatedStorage.Teleport:FireServer(script.Parent.Parent.Username.Text)
  23.     end
  24. end)
Tags: Roblox
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement