Good morning, I have a problem with the teleport script of a morph: actually the player with the morph should be teleported to another game when he touches one of the pieces (morph data is saved and retrieved again in my other game). The player takes on the character of the morph again.
But somehow the data in the other game is always discarded and so the player no longer has a morph character. Does anyone know how I can fix this?
Are there any errors?? We need to know some information on this, such as the source code so we can help you debug it
Here are the Scripts :
The Morph Script:
local Model = script.Parent
local Pad = Model.MorphingPad
local Debounce = true
Pad.Touched:Connect(function(obj)
local Player = game.Players:GetPlayerFromCharacter(obj.Parent)
if Player and Debounce == true then
Debounce = false
Pad.Material = Enum.Material.Neon
local OldCharacter = Player.Character
local MorphModel = Model:FindFirstChildOfClass("Model")
local NewCharacter = MorphModel:Clone()
NewCharacter.Name = Player.Name
local Humanoid = NewCharacter:FindFirstChildWhichIsA("Humanoid")
Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.Viewer
NewCharacter.HumanoidRootPart.Anchored = false
NewCharacter:SetPrimaryPartCFrame(OldCharacter.PrimaryPart.CFrame)
Player.Character = NewCharacter
NewCharacter.Parent = workspace
wait(.5)
Pad.Material = Enum.Material.Plastic
Debounce = true
end
end)
The Morph Teleport Script :
local Players = game:GetService(“Players”)
local TeleportService = game:GetService(“TeleportService”)
local TARGET_PLACE_ID = 16840381651 – Ersetze dies durch deine eigene Platz-ID
local function teleportPlayer(player)
local playerData = {
morphCharacter = player.Character.MorphCharacter,
}
TeleportService:TeleportAsync(TARGET_PLACE_ID, {player})
repeat
wait()
until player.Character
player.Character.MorphCharacter = playerData.morphCharacter
end
local triggerPart = game.Workspace.Part
triggerPart.Touched:Connect(function(otherPart)
local player = game.Players:GetPlayerFromCharacter(otherPart.Parent)
if player then
teleportPlayer(player)
end
end)
sorry for the late response, could you try to properly format the codeblock and show us if there are any errors in the console?
No errors are shown, only when I am teleported to the other game all data is discarded