I just started learning about region 3, and I want to make a region that appears in front of the player when he presses a key. The problem is that the region3 always get in the same direction no matter how I move the player. can someone help me settle it please??
Here is the script,
local c = plr.Character
local Reg = Region3.new(c.HumanoidRootPart.Position-Vector3.new(0,2.5,2.5),c.HumanoidRootPart.Position +Vector3.new(20,2.5,2.5))
local Part = Instance.new("Part",workspace)
Part.CFrame = Reg.CFrame
Part.Size = Reg.Size
Part.Anchored = true
Part.CanCollide = false
Part.Transparency = 0.8
local Rtable = workspace:FindPartsInRegion3(Reg,c)
for i,v in pairs(Rtable) do
print(v)
if v.Parent:findFirstChild('Humanoid') and v.Parent.ClassName == 'Model' and v.Parent:findFirstChild('AoEDebounce')== nil then
local Deb = Instance.new('BoolValue',v.Parent)
local BV = Instance.new("BodyVelocity",v)
BV.MaxForce = Vector3.new(25000,25000,25000)
BV.Velocity = c.HumanoidRootPart.CFrame.LookVector * 50
game.Debris:AddItem(BV,0.5)
Deb.Name = 'AoEDebounce'
game.Debris:AddItem(Deb,1)
v.Parent.Humanoid:TakeDamage(30)
end
end

1 comment
I tried your idea but it still doesn't work. It say: invalid argument #1 to 'new' (Vector3 expected,got CFrame)