-
What do you want to achieve?
I would like to be able to call LoadCharacter() and have the player return to the same position they were at before calling this function. -
What is the issue?
After enabling R15 on my game (it was initially only set to R6), this script has broken and isn’t working correctly. Nothing after calling LoadCharacter() runs, including the code that returns the player back to the position they were at earlier. The print statement after this function won’t print either. -
What solutions have you tried so far?
Tried adding waits and doing research on this but I am not seeing any reason why this is happening since it was working fine before enabling R15 support.
Here is the code for the script I am using. For context, this is inside of a GUI button that a player would press.
local plr = script.Parent.Parent.Parent.Parent
script.Parent.MouseButton1Click:Connect(function()
local a = plr.Character:WaitForChild("HumanoidRootPart").CFrame
print(a)
plr:LoadCharacter(true) --Anything beyond this function doesn't run, but the player still respawns
plr.Character:WaitForChild("HumanoidRootPart").CFrame = a
print(plr.Character:WaitForChild("HumanoidRootPart").CFrame)
print("This isn't printing!")
end)
Is this supposed to be intentional? And if so, how can I return the player to their previous position using their Cframe?
Edit: Just to clarify, the goal of this script is to refresh the player without having them return to the spawn. When calling this function they were able to respawn and then be teleported back to their previous position, but now it just respawns them and leaves them at the spawn.