Strings not printing correctly in output

  1. What do you want to achieve? Keep it simple and clear!
    I need to make a table transfer in a teleport (You may have seen a post on a similar topic that I have done but that was because I did table.concat wrong apparantely)
  2. What is the issue? Include screenshots / videos if possible!
    The script will not get the string value properly. It prints the string value empty.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried getting the values as objects then retrieving the values in the table but it still results empty.

It might be because it is a local script but I don’t think that is the issue

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local camera = workspace.CurrentCamera
local tps = game:GetService('TeleportService')
local deb = false
local clicked = false
local button = workspace:FindFirstChild("PlayPart").ClickDetector
local event = game.ReplicatedStorage:WaitForChild("Events"):WaitForChild("PlayWasPressed")

Hair = player.CustomFolder.HairValue
Face = player.CustomFolder.FaceValue
Accessory = player.CustomFolder.AccessoryValue
Skin = player.CustomFolder.SkinValue
Shirt = player.Clothes.Shirt

local data = {
	hair = Hair.Value;
	face = Face.Value;
	accessory = Accessory.Value;
	skin = Skin.Value;
	shirt = Shirt.Value
				}

button.MouseClick:Connect(function()
	if not deb then
		if clicked == false then
			deb = true
			for i = 0,1,0.1 do
				camera.CFrame = camera.CFrame:Lerp(workspace.PlayCamera.CFrame,i)
				wait()
			end
			event:FireServer()
          for i,v in pairs(data) do
		            wait()         --This is the important part*
		            print(v)
	      end
			wait(3.3)
			tps:Teleport(gameid,player,data)
			clicked = true
			deb = false
	end
end
  • When the for i, v loop runs, they all print a blank space.

If you know how I can fix this then it would be very appreciated.

Have you tried this?

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local camera = workspace.CurrentCamera
local tps = game:GetService('TeleportService')
local deb = false
local clicked = false
local button = workspace:FindFirstChild("PlayPart").ClickDetector
local event = game.ReplicatedStorage:WaitForChild("Events"):WaitForChild("PlayWasPressed")

local data = {
    Hair = player.CustomFolder.HairValue,
    Face = player.CustomFolder.FaceValue,
    Accessory = player.CustomFolder.AccessoryValue,
    Skin = player.CustomFolder.SkinValue,
    Shirt = player.Clothes.Shirt,
}

button.MouseClick:Connect(function()
	if not deb then
		if clicked == false then
			deb = true
			for i = 0,1,0.1 do
				camera.CFrame = camera.CFrame:Lerp(workspace.PlayCamera.CFrame,i)
				wait()
			end
			event:FireServer()
          for i,v in pairs(data) do
		        wait()         --This is the important part*
		        print(v.Value) -- this would get the newest value
	      end
			wait(3.3)
			tps:Teleport(gameid,player,data)
			clicked = true
			deb = false
	end
end
1 Like