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
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