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

Upon joining my game, your character will appear sideways visually. How do I fix this?

Asked by 1 year ago

You can still move around normally, but the character is at a 90° angle. It fixes once you die. Here is the script I believe is the problem. My game is an obby, and this script helps run the checkpoint system:

game.Players.PlayerAdded:Connect(function(plr)
    local stage = plr:WaitForChild("leaderstats").Stage
        plr.CharacterAdded:Connect(function(char)
        repeat wait() until plr.Character ~= nil
        wait(0.01)
        local checkpoint = game.Workspace.Stages:FindFirstChild(stage.Value)
        char:FindFirstChild("HumanoidRootPart").CFrame = CFrame.new(checkpoint.Position + Vector3.new(0,5,0), checkpoint.Position)
        char:FindFirstChild("HumanoidRootPart").Orientation = Vector3.new(0,0,0)
        wait(0.1)
    end)
end)

1 answer

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

I see the problem. It is a bit difficult to understand, but I will show you what is wrong. Starting on Line 7, it says CFrame.new(checkpoint.Position + Vector3.new(0,5,0)Also, don't put anything inside of here like you did.)

Problem 1)

On line 7 you did + Vector3.new. This is wrong, you need to do this:

 char:FindFirstChild("HumanoidRootPart").CFrame = CFrame.new(checkpoint.Position 
 * Vector3.new(PROBLEM TO FIX LATER), checkpoint.Position)

2) You need to change the way your CFrame is:

char:FindFirstChild("HumanoidRootPart").CFrame = CFrame.new(char:FindFirstChild("HumanoidRootPart").Position * checkpoint.Position)

You may also find when you are using CFrame and editing a Vector3 Value that it isn't working with straight numbers. That is because CFrame works in Radiants. Follow this example to convert Radiants to degrees in your code:

Vector3.new(0,math.rad(5), 0)

If something is still wrong, remove line 8.

Good job with your script! Keep believing you can make a big thing out of this, and you will!

If I answered the question, please mark me as "answered".

Thanks, -fiddyfiddler

0
Worked! Tysm BunjiBloxxer 51 — 1y
0
Wow! I'm surprised! Good job! fiddyfiddler 18 — 1y
Ad

Answer this question