How would I create a Wind Effect?

I’ve been working on a game for a while where you climb a mountain and I would like to add an obstacle such as wind. that will slowly move the player in one direction if they are in a given area. Anybody know where to start on this?

use a particle effect or the boatbomber wind module for the visuals

you can use some zone module like this to detect when the player enters/leaves

on enter, put a force inside the character pushing them towards the wind direction (probably linearvelocity)
on leave, delete the force

1 Like

Messing around with it.

--ServerScriptService windbox zonebox script test
local function createZone(zonePart, windDirection, windForce, onEnter, onLeave)
	local playersInZone = {}

	zonePart.Touched:Connect(function(hit)
		local char = hit.Parent
		local player = game.Players:GetPlayerFromCharacter(char)
		if player and not playersInZone[player] then
			playersInZone[player] = true
			local root = char:FindFirstChild("HumanoidRootPart")
			if root then
				local attachment = Instance.new("Attachment", root)
				local force = Instance.new("VectorForce")
				force.Attachment0 = attachment
				force.Force = windDirection * windForce
				force.RelativeTo = Enum.ActuatorRelativeTo.World
				force.ApplyAtCenterOfMass = true
				force.Parent = root
			end
			if onEnter then onEnter(player) end
		end
	end)

	zonePart.TouchEnded:Connect(function(hit)
		local char = hit.Parent
		local player = game.Players:GetPlayerFromCharacter(char)
		if player and playersInZone[player] then
			playersInZone[player] = nil
			local root = char:FindFirstChild("HumanoidRootPart")
			if root then
				for _, v in ipairs(root:GetChildren()) do
					if v:IsA("VectorForce") or v:IsA("Attachment") then
						v:Destroy()
					end
				end
			end
			if onLeave then onLeave(player) end
		end
	end)
end


local zonePart = workspace:WaitForChild("ZoneBox")
--[[Place a Box Part on the workspace named ZoneBox

set ZoneBox to;
zonePart.Anchored = true
zonePart.CanCollide = false
zonePart.CanTouch = true
zonePart.CastShadow = false
zonePart.Locked = true
zonePart.Massless = true
zonePart.Transparency = 1
--]]

createZone(zonePart, Vector3.new(1, 0, 0), 12000 --direction & speed
	,function(player) print(player.Name .. " entered the zone")end
	,function(player) print(player.Name .. " left the zone")
end)

ZoneBox would be a Box Part where you want the wind to be.

I understand how it works now and I managed to get it to work.

Thanks!

1 Like