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

I have a script that titls the character but it rarely works and spams the output, whats the issue?

Asked by 3 years ago

Okay, so first of all, I own a game, doesn't matter the name, based on the series "Sonic the hedgehog"

This specific script that I own just like in the sonic games your character, whenever he is walking trough slopes the main part such as the "torso" or the "root part" tilts to the ''slope'' neither going downwards or upwards.

The thing is that sometimes it barely works, I've sent it to trough many people and, they all said the script makes no sense. Whenever u die the output gets spammed by this

HumanoidRootPart is not a valid member of Model "Workspace.PerfectGamer1232

And in general, sometimes, it rarely works. I really need this script so, if anyone can help me with that, I would appreciate it

SCRIPT:

local plr = game.Players.LocalPlayer
local character = plr.Character or plr.CharacterAdded:Wait()

local RS = game:GetService("RunService")

character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)

local rotation = 0
local rdown = false
local rotstep = math.rad(2)

character.Humanoid.WalkSpeed = 0

RS.Heartbeat:connect(function()
    local ray = Ray.new(character.HumanoidRootPart.Position, Vector3.new(0,-3.6,0))
    local hit, position, normal = workspace:FindPartOnRayWithIgnoreList(ray, {character}, false, true)

    if hit then         
        local npos = character.HumanoidRootPart.CFrame.p

        character.HumanoidRootPart.CFrame = CFrame.fromMatrix(npos,character.HumanoidRootPart.CFrame.lookVector:Cross(normal),normal,-character.HumanoidRootPart.CFrame.lookVector)
        character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, false)
    else
        character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, true)
    end
end)

BTW the script is a local script in the starter character scripts TY

0
whats the full error? Gameplayer365247v2 1055 — 3y

Answer this question