Okay. I'm real stumped about this one. I wouldn't say I'm an 'experienced' LUA person, but my knowledge has allowed me to help revamp a game known as 'Steven Universe: 3D Roleplay' with my friend Firelexy. I've become the main scripter since then, and we decided to try out something new: sending data between 'places' using that feature ROBLOX added.
What I'm trying to accomplish is sending current Morph data, including morph name, class, and CameraOffset (we use this to relocate the camera to the head of the morph). Most of it works, however, some lines mysteriously do not work.
Player = game.Players.LocalPlayer repeat wait() until Player.Character Character = Player.Character Character:WaitForChild("Humanoid") local teleport = game:GetService("TeleportService") local teleportdata = teleport:GetLocalPlayerTeleportData() if teleportdata then print(teleportdata.charName) print(teleportdata.charClass) print(teleportdata.offset) local char = (teleportdata.char) end char = (teleportdata.char .. 'Morph') offset = teleportdata.offset script.parent.TextLabel.Text = (char) Player.Character.Humanoid.CameraOffset = Vector3.new(offset) if char == "NullDefaultMorph" then print("No Morph!") else game.Workspace.MorphFuncs.PlayerClear:FireServer() game.Workspace.MorphFuncs:WaitForChild((char)):FireServer() end
Most of everything you see here will work, when I teleport from one place to the other, it receives the data (I have it print what it receives), it will apply the morph to the character, however, it seems as if it 'skips' the CameraOffset line and firing the PlayerClear event.
The odd thing is they do not report any errors in the console, both in Studio and in game, in fact when I manually morph, they work just fine. This has been an ongoing issue since the beginning of my work, and I do not understand why. Anyone who's more wise, please spare my soul from LUA hell!