Question. Can I mess with a script to make something move to the parent’s location, but down a couple studs?
wood:MoveTo(script.Parent.Position)
wood:MoveTo(script.Parent.Position + Vector3.new(0, -1, 0)) would probably work
1 Like
Use CFrames! They’ll be your best friend! Try the following:
wood.CFrame = Wood.CFrame * CFrame.New(0,-1,0) -- Change the Y-Axis value as you'd like it to move up and down.
Would I replace it, or where would I put it? Here’s my script:
local wood = game.ReplicatedStorage.Ore:Clone()
wood.Parent = workspace
wood:MoveTo(script.Parent.Position)
wait(.1)
for i,v in pairs(wood:GetChildren()) do
if v:isA("Part") or checkif_isA_Part == false then
v.Anchored = true
end
end ```
If you aren’t messing with the orientation, replace wood:MoveTo(script.Parent.position) with wood.Position = script.Parent.Positon + Vector3.new(0,-1,0), you may also use Cframes if you would like
I didn’t realize it was a model.
You can use:
wood:SetPrimaryPartCFrame(script.Parent.CFrame + Vector3.new(0,-1,0))
If no primary part exist for the model, it will throw an error
Replace it here. This is the line where you need to replace it with.
1 Like