ok whats going on
so imagine this. you made a variable.
var = 1
then you made it print the variable
var = 1 print(var)
then you set it to a textlabel in a gui
var = 1 print(var) script.Parent.textlael.Text = var
...then the textlabel said 0.
can somebody explain what causes this? my code:
sp = script.Parent sp.winslabel.Text = "wins" sp.losslabel.Text = "losses" player = script.Parent.Parent.Parent.Parent player:WaitForChild("wins") player:WaitForChild("losses") sp.playername.Text = player.name wins = player.wins.Value losses = player.losses.Value data = game:GetService("TeleportService"):GetLocalPlayerTeleportData() print(data) datadata = data if datadata == 1 then --goes wrong in this loop wins = wins + 1 player.wins.Value = player.wins.Value + 1 print("win") sp.winswins.Text = wins sp.losseslosses.Text = losses print(wins) print(losses) end if datadata == 0 then --goes wrong in this if loop losses = losses + 1 player.losses.Value = player.losses.Value + 1 print("loss") sp.winswins.Text = wins sp.losseslosses.Text = losses print(wins) print(losses) end
thanks so much!
Edit: OP had a bigger problem where data wasn't being saved when the user was teleporting, so this was a data service error not related to this script. Fixed in team create.
local player = game.Players.LocalPlayer local WinsStats = player:WaitForChild("wins") local LossesStats = player:WaitForChild("losses") local sp = script.Parent sp.playername.Text = player.name sp.winslabel.Text = "wins" sp.losslabel.Text = "losses" sp.winswins.Text = WinsStats.Value sp.losseslosses.Text = LossesStats.Value