Hey I’m having trouble scripting a fan that is suppose to push a player in the direction the fan is facing like you see here.
But the player sometimes get pushed to the sides and not forward (where the fan is facing)
I’m not sure how to fix this
Btw the vectorforces attachment0 is in the player’s humanoidrootpart
Code:
local FanBlades: BasePart = fan:FindFirstChild("FanBlades",true)
local RayPart: BasePart = FanBlades.Ray
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = {fan}
RunService.Heartbeat:Connect(function()
local raycast = workspace:Raycast(RayPart.Position,RayPart.CFrame.LookVector * 35,params)
if raycast then
if raycast.Instance then
if raycast.Instance.Parent:FindFirstChild("Humanoid") then
local VectorForce: VectorForce = raycast.Instance.Parent.PrimaryPart:FindFirstChildOfClass("VectorForce")
if VectorForce then
VectorForce.Force = Vector3.new(15000,0,15000)
print("Set",VectorForce.Force)
task.delay(.8,function()
VectorForce.Force = Vector3.zero
end)
end
end
end
end
end)```