So i've been trying to make a teleport data script. and it doesn't seem to work. i've tried everything! and sadly nothing worked... so if you have any solution to this major problem, please let me know! and feel free to ask for more info if needed! :D
COMMUNITY QUESTION
teleport data script doesn't seem to work..?
1 answer
this is a placeholder so i can see the script more clearly (dont copy this script it's wrong )
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
character = player.CharacterAdded:Wait()
end
local teleportData = TeleportService:GetLocalPlayerTeleportData()
if teleportData and teleportData.Chords.Value + 100 then
local getchords = game.Players
getchords.leaderstats = teleportData.Chords.Value + 100
end
Ok, so for the thing you were wrong is detecting a Instance as false? Instances are instances, not a value, what it returns is void so you will not get a result. Also, at line 4, if the player is not loaded, it will occur an error and stop the script. You also tried to overlap the character variable by detecting character, but why not just do that first?
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait() -- Better way! (Also works!)
The second part of the script, you attempted to plus a if statement??? What are you trying to do? Can you tell me in the comments?
Thanks for reading, by the way, heres a semi-completed script
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait() -- Better way! (Also works!)
local teleportData = TeleportService:GetLocalPlayerTeleportData()
if teleportData and teleportData.Chords.Value + 100 then -- This line is an error, please tell me what are you trying to do!
player:WaitForChild("leaderstats").Chords.Value += 100 -- Plus the value, you cannot plus an instance, you gotta type in them twice, but here's a shortcut
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

7 comments
Couple links. #1. https://developer.roblox.com/en-us/articles/Teleporting-Between-Places #2 https://www.youtube.com/watch?v=ZXjraCYGpnk
could you post the code and tell us where the error is if there is any
local Players = game:GetService("Players") local player = game.Players.LocalPlayer local teleportData = { jobId = game.Players.LocalPlayer.leaderstats.Chords.Value == game.Players.LocalPlayer.leaderstats.Chords.Value + 100 } game:GetService("TeleportService"):Teleport(6490820945, player, teleportData)
should this script work?
local TeleportService = game:GetService("TeleportService") local Players = game:GetService("Players") local player = Players.LocalPlayer local character = player.Character if not character or not character.Parent then character = player.CharacterAdded:Wait() end
uh, idk what that is because i just started scripting a week ago
local teleportData = TeleportService:GetLocalPlayerTeleportData() if teleportData and teleportData.Chords.Value + 100 then local getchords = game.Players getchords.leaderstats = teleportData.Chords.Value + 100 end