How to make trees blow in the wind

Any idea how to use a single script to make all trees near the player blow in the wind? Only when the player is close enough or looking at the trees should they blow in the wind.

Tons of videos on how to do it but they are all only for constantly blowing which causes lag.

1 Like

You can do it in a LocalScript. You can be constantly checking with a while loop the distance between the client’s HumanoidRootPart and the Tree, and if they are close enough, make the tree blow in the wind.

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()

local Tree: Part? = nil -- Your tree base or trunk here
local Radius = 50 -- The distance required for the tree to blow in the wind

while task.wait() do
	local HRP = Character:FindFirstChild("HumanoidRootPart")
	if HRP and (HRP.Position - Tree.Position).Magnitude < Radius then
		
		-- Stuff here
		
	end
end
2 Likes

Hey thanks for the reply. So the model of the tree that I want to move is located in the workspace inside of a folder. the model in the folder has the parts of the tree. do i use getchildren?

What i would do it’s weld all parts from your tree model to his primary part then Anchor it to make it solid , or make one, And then you wouldn’t have to use “GetChildren()” and iterate it, Ofcourse, if you want the trees blow, you would need to Unanchor the PrimaryPart, (tip : you could make the primary part the branch or a fake invisible branch)

But, @ShermaanCat Answer is correct For the first part

And, as for blowing it, you could insert into the script, Make a VectorForce Or Linear Velocity to the primary part, or just raw do :ApplyImpulse() to it

you can see the difference between them here

  • Because the VectorForce constraint applies constant force and acceleration, very high speeds may result if no other forces are involved. If you want to maintain a more steady velocity over time, use a LinearVelocity constraint.
* If you want to control the amount of force applied, use a VectorForce constraint.
* If you only need initial linear velocity, set the AssemblyLinearVelocity property directly on the assembly.

Example :

local Tree = pathYourTree  -- (model i assume)
local TreePrimaryPart = Tree.PrimaryPart -- or Just a Part inside the tree model

local Force = Instance.new("LinearVelocity")
local ForceAttachment = Instance.new("Attachment")
ForceAttachment.Parent = Tree.PrimaryPart
ForceAttachment.Position = Vector3.new(0,0,0) -- the center of the primary part, anchor point likely

Force.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
Force.MaxForce = 5000 -- Must be Higher if you think the model weight it's high or just plain doesn't works

Force.Attachment0 = ForceAttachment



Force.VectorVelocity = Vector3.new(0, 100, 0) -- the direction you want the tree to be blown into, you can experiment with this