Im Making a Teleporter to My friends airline on roblox. Idk what to say more. heres the script (The Problem will be written down below)
01 | local Teleporter = script.Parent |
02 | local Teleporter 2 = script.Parent.Parent.Teleporter 2 |
03 | local debounce = false |
04 | Teleporter.Touched:Connect( function () |
05 | if debounce = = false then |
06 | debounce = true |
07 | game.Players.LocalPlayer.character.Torso.CFrame = CFrame.new(workspace.Teleporter 2. Position) |
08 | debounce = false |
09 | end |
10 | end ) |
Now Why does it give out error? Cuz I have been doing the same before (In another way of teleporting).
Please help
You should be handling this on the server, which means we cant use LocalPlayer. Try this:
01 | local Teleport 1 = -- Put the first Teleporter here. |
02 | local Teleport 2 = -- Put the second Teleporter here. |
03 | local Deb = false ; |
04 |
05 | Teleport 1. Touched:Connect( function (Hit) |
06 | local Player = game.Players:GetPlayerFromCharacter(Hit.Parent); |
07 | if Player and Deb = = false then |
08 | Deb = true ; |
09 | Player.Character:MoveTo(Teleport 2. Position); |
10 | Deb = false ; |
11 | end |
12 | end ) |
Its in Localscript. I attempted it but it says no errors but dont works
01 | local Teleporter = script.Parent |
02 | local Teleporter 2 = script.Parent.Parent.Teleporter 2 |
03 | local debounce = false |
04 | Teleporter 2. Touched:Connect( function () |
05 | if debounce = = false then |
06 | debounce = true |
07 | game.Players.LocalPlayer.Character.Torso.CFrame = CFrame.new(workspace.Teleporter.Position) |
08 | debounce = false |
09 | end |
10 | end ) |
.,_,.