Make Part Spawn On Ground EveryTime

Local Script

		player.Mana.Value = player.Mana.Value - 0.05
		local Mousepos = Mouse.hit.p
		script.RemoteEvent:FireServer("Second", Mousepos)--Whatever function you would like to call


		local NIceV = IceV:Clone()
		NIceV.Parent = game.Workspace
		local antiGravity1 ="BodyForce")
		antiGravity1.Force =, workspace.Gravity * NIceV:GetMass(), 0)
		antiGravity1.Parent = NIceV
		NIceV.Position = Mousepos

Why I need help: I want the part to spawn at the Mouse position but I want it to spawn on the ground everytime. For example if a player point in the air then the part going to spawn in the air. Sometimes if a player point at the bottom it spawn under the ground.

Question: How would I make it y position the same all the time?

Change this line to:

local Mousepos =, 0, Mouse.hit.p.Z)

I haven’t tested this but it might work.

1 Like
local Mousepos = Mouse.hit.Position

Doing this is wrong since it will get Mouse Position in a Vector3 value completely

local MouseZ = Mouse.hit.Z
local MouseX = Mouse.hit.X
local MouseY = 0

And putting this in a Vector3 value like

ExamplePart.CFrame =,0,MouseZ)

Will solve your problem!

Whell, Just do this:

Part.Position = mouse.hit.p

Why? Try this

local Mousepos =,MouseY,MouseZ)

This script would change position of mouse and not work, Change the parts CFrame not Mouse’s also this guy wants part’s position to stay on ground so you would make Y = 0 in order to do this.

1 Like

So this?

local Mousepos =,0,MouseZ)
1 Like

No, You would set part’s location not Mouse’s.

Part.CFrame =,0,MouseZ)
1 Like
Ok lol test only

Maybe it works

No, MouseX and MouseZ is for a 2d GUI. try, Part.Position =, 0, MousePos.Z)

1 Like

Yeah that worked even though I figured out by myself on my own. :smiley: