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

Player spawns in a 90 degree angle most of the time?

Asked by 4 years ago

So the problem is that the player sometimes spawns in a 90 degree angle then takes 2 seconds to stand up. Heres my code, tell me if anything is wrong.

player.CharacterAdded:Connect(function(character)
    wait()
    for i,v in pairs(findBase) do
        local owner = v:FindFirstChild("Owner")
        if v.Owner.Value == character.Name then
            local hum = character:FindFirstChild("Humanoid")
            hum.RootPart.CFrame = v.Cookie.CFrame + Vector3.new(0,5,0)
        end
    end
end)


1 answer

Log in to vote
0
Answered by 4 years ago

Since you're getting the raw CFrame of the Cookie part rotation will also be applied, since you don't want this to happen you can instead get the position of the part so rotation wont be applied.

player.CharacterAdded:Connect(function(character)
    wait()
    for i,v in pairs(findBase) do
        local owner = v:FindFirstChild("Owner")
        if v.Owner.Value == character.Name then
            local hum = character:FindFirstChild("Humanoid")
            hum.RootPart.CFrame = CFrame.new(v.Cookie.Position) + Vector3.new(0,5,0)
        end
    end
end)
Ad

Answer this question