Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Save location when Loading Character?

Asked by 5 years ago

so I have this game where I have a GUI Text button with a local script inside it that sends a remote event to server script storage to activate a script, but the server script isn't working as intended

Client

    script.Parent.MouseButton1Click:Connect(function()

wait(0.8)

game.ReplicatedStorage.TransformBack:FireServer()

end)

Server

game.ReplicatedStorage.TransformBack.OnServerEvent:connect(function(player)

local Char = player.Character or player.CharacterAdded:wait()

local Torso = Char:FindFirstChild("LowerTorso")

local Morphs = workspace:FindFirstChild("Morphs")

local PlrGui = player:FindFirstChild("PlayerGui")

local Pos = Torso.Position



--(6.3, 1324.96, 31.38) original pos

local p = Instance.new("Part")

p.Anchored = true

p.Transparency = 1

p.CanCollide = false

p.CFrame = CFrame.new(Pos)

player:LoadCharacter()

wait(0.3)

Torso.CFrame = CFrame.new(p.Position)

p:Destroy()

end)

yeah I'm guessing the script loads the character and looses the player, and so the script doesn't continue.. what am I doing wrong?

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

If This helped you Please put [SOLVED] in your title Thanks

1: Don't teleport the Torso because it removes the torso from the head and kill the player. Instead teleport the HumanoidRootPart which is located in game.Workspace.PlayerName.HumanoidRootPart.CFrame

2: Your using R15 there's no Torso in R15

3: Instead of Position use CFrame

4: Sorry if i sound rude Lmao

A good way to save a positions And teleport is:

local Pos = CFrame.new(Vector3.new(Your Position))

game.Workspace.PlayerName.HumanoidRootPart.CFrame = Pos

if it worked please put [SOLVED] in your title and please leave me an Upvote :)

0
Nope, still respawning at spawn.. RealCGZXZ -9 — 5y
0
ok wait ill make a teleport script for you Oskar2266001 3 — 5y
Ad

Answer this question