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

teleport data script doesn't seem to work..?

Asked by 3 years ago

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

0
could you post the code and tell us where the error is if there is any grandiosav4 62 — 3y
0
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) KoneGFX 2 — 3y
0
should this script work? KoneGFX 2 — 3y
View all comments (3 more)
0
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 KoneGFX 2 — 3y
0
uh, idk what that is because i just started scripting a week ago Xyternal 247 — 3y
0
local teleportData = TeleportService:GetLocalPlayerTeleportData() if teleportData and teleportData.Chords.Value + 100 then local getchords = game.Players getchords.leaderstats = teleportData.Chords.Value + 100 end KoneGFX 2 — 3y

1 answer

Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
3 years ago

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
Ad

Answer this question