The IsGrounded
function won't work because the part is anchored itself, i have tried everything else and i cannot make this to work. I am not asking for the whole thing, just the basic idea.
On a flat plane, disassembling's idea would be the best way.
But if you have multiple levels of terrain, you clearly must do something different.
What I did in a similar situation is use raycasting. Basically, we just raycast straight down. If it hits something, then we know it's on the ground.
function checkPart(part) local ray = Ray.new(part.Position, Vector3.new(0, -5, 0)) local hit, position = workspace:FindPartOnRay(ray) if hit then return true end end
Of course, the -5
will vary depending on the size of the part you want to check. You could make this automatic with a few edits.
You can try by detecting wether the part's Y axis is 0 ( I haven't tested this as I am at school ) But an example would be:
local r = Instance.new("Part", game.Workspace) r.Anchored = true r.CFrame = CFrame.new(2, 5, 0) if r.CFrame.y == 0 then print("it is grounded, and anchored") elseif r.CFrame.y > 0 or r.CFrame.y < 0 then print("It is not grounded, either above 0 or below, and is anchored") end wait(5) r:Destroy() print("Script should go through.)