I'm not sure if this is possible, but I was wondering if I could make a cloned model's y position always touch the ground. That probably doesn't make sense so let me explain: I want to make a clam's position spawn in the ocean in my game but the ocean has very uneven ground so if I just set a specific y position the clam, at times may look like it is floating. So I want to make it so that the clam always spawns on the ground. If someone could help me that would be greatly appreciated, thanks!
I've fixed my problem above but the only problem is the only part that moves is the PrimaryPart of the model which is TouchingPart but I don't know how I would move the entire model to the position of TouchingPart.
Here's my code so far:
game.Workspace.Clams["Closed Clam"].HasPearl.Value = false
if game.Workspace.Clams["Closed Clam"].HasPearl.Value == false then
game.Workspace.Clams["Closed Clam"].HasPearl.Value = true
local Clam = game.Workspace.Clams["Open Clam"]:Clone()
Clam.Parent = workspace
Clam:MoveTo(game.Workspace.Clams["Closed Clam"].PositionPart.Position)
game.Workspace.Clams["Closed Clam"]:Destroy()
local TouchingParts = Clam.TouchingPart:GetTouchingParts()
if not TouchingParts then
repeat Clam.TouchingPart.Position = Clam.TouchingPart.Position + Vector3.new(0,-1,0) until TouchingParts ~= nil
end
Clam:MoveTo(Clam.PrimaryPart.Position)
print("Worked")
end
