#My humanoid is flying

1 messages · Page 1 of 1 (latest)

zenith jetty
#

can anyone help me? Im guessing its a setting i have to change on the humanoid but im not sure what one.

I'm trying to have a placeable npc that will do custom emotes and talk e.g

tawny steppe
#

^

zenith jetty
#

@storm ivy @tawny steppe this is the code i use for the display of part before i place it

local isBuilding = false
local currentRenderConnection = nil
local previewModel = nil

local function toggleBuildMode()
    isBuilding = not isBuilding

    if isBuilding and activeModelTemplate then
        previewModel = activeModelTemplate:Clone()
        previewModel.Parent = workspace
        
        for _, part in pairs(previewModel:GetDescendants()) do
            if part:IsA("BasePart") then
                part.CanCollide = false
                part.Anchored = true
                part.Transparency = 0.5
                part.CastShadow = false
            elseif part:IsA("Decal") or part:IsA("Texture") then
                part.Transparency = 0.5
            end
        end

        currentRenderConnection = RunService.RenderStepped:Connect(function()
            if previewModel and placement then
                local cf = placement:CalcPlacementCFrame(previewModel, mouse.Hit.p, 0)
                previewModel:SetPrimaryPartCFrame(cf)

                local colliding = placement:isColliding(previewModel)
                local previewColor = colliding and Color3.new(1, 0, 0) or Color3.new(0, 1, 0)

                for _, part in pairs(previewModel:GetDescendants()) do
                    if part:IsA("BasePart") then
                        part.Color = previewColor
                    end
                end
            end
        end)
    else
        if currentRenderConnection then
            currentRenderConnection:Disconnect()
            currentRenderConnection = nil
        end
        if previewModel then
            previewModel:Destroy()
            previewModel = nil
        end
    end
end```
tawny steppe
#

The issue is when you place it

#

Not viewing it

zenith jetty
#

It’s when I view it

#

In the video I’m viewing it

#

I click the button called “worker” which starts the local view, where the worker goes flying in the air

tawny steppe
#

Like what's the primary part

zenith jetty
#

So a box that’s invisible that contains everything

tawny steppe
#

Thats a function you made?

#

Can I see it

zenith jetty
# tawny steppe Whats calcplacementcframe
function Placement:CalcPlacementCFrame(model, position, rotation)
    local cf, size = self:CalcCanvas()
    local modelSize = CFrame.fromEulerAnglesYXZ(0, rotation, 0) * model.PrimaryPart.Size
    modelSize = Vector3.new(math.abs(modelSize.x), math.abs(modelSize.y), math.abs(modelSize.z))

    local lpos = cf:pointToObjectSpace(position)
    local size2 = (size - Vector2.new(modelSize.x, modelSize.z))/2
    local x = math.clamp(lpos.x, -size2.x, size2.x)
    local y = math.clamp(lpos.y, -size2.y, size2.y)

    -- Grid Snapping
    local g = self.GridUnit
    if (g > 0) then
        x = math.sign(x)*((math.abs(x) - math.abs(x) % g) + (size2.x % g))
        y = math.sign(y)*((math.abs(y) - math.abs(y) % g) + (size2.y % g))
    end

    return cf * CFrame.new(x, y, -modelSize.y/2) * CFrame.Angles(-math.pi/2, rotation, 0)
end```