I’m currently trying to accomplish making a bee float a few studs off the ground, while attacking nearby humanoids
The problem is, I don’t know how I would make the bees float(body-velocities made the bees keep on floating up)
Really the only things I’ve tried were body-movers, but another problem is that I don’t understand the concept that much, I’ve looked at a lot of topics on the forum, and nothing really helped.
Some details, the bees are small, they have animations, and they attack nearby players.
local model = PUTMODELHERE
local mass_sum = 0
local force = PUTFORCEHERE
for i, v in pairs(model:GetChildren()) do
if v:IsA("BasePart") or v:IsA("MeshPart") then
mass_sum = mass_sum + v:GetMass()
end
end
force.Force = Vector3.new(0, mass_sum * workspace.Gravity, 0)
I made a script like that but, after I tested, the bee spawned on the floor, I went to the server side and moved the bee up and the floating worked, I tried setting the bee’s position and I’m not sure why, but the bee still stays on the floor until you move it on the server side, here is what the script looks like
function getmodelmass(model)
local totalmass = 0
for i, v in pairs(model:GetChildren()) do
if v:IsA("BasePart") or v:IsA("MeshPart") or v:IsA("UnionOperation")then
totalmass = totalmass + v:GetMass()
end
end
return totalmass
end
local totalmass = getmodelmass(script.Parent.Parent)
local massgravityratio = totalmass * workspace.Gravity
getmodelmass(script.Parent.Parent)
Bforce.Force = Vector3.new(0, massgravityratio, 0)
script.Parent.CFrame = workspace.Startpos.CFrame