I’m making a jetstream type ability that creates a wind passage like a conveyor, which applies linearvelocity to people who touch it.
Since it could be facing any direction, I can’t make it relative to World, however when I switch it to relative to attachment1 which achieves the effect I want, it ends up messing with .Touched/.TouchEnded a lot and fires it a ton of times, as seen in the clip.
I’d be fine making it relative to World if I could find a way to make the velocity apply to the blocks LookVector, but not really sure how to accomplish that. If you have a solution/improvements then that’d be great
local Conveyor = script.Parent
local Velocity = script.LinearVelocity
local Players = {}
Conveyor.Touched:Connect(function(Object)
if Object.Parent:FindFirstChild("HumanoidRootPart") and not Players[Object.Parent.Name] then
local RootPart = Object.Parent:FindFirstChild("HumanoidRootPart")
local ConveyorVelocity = Velocity:Clone()
ConveyorVelocity.Name = "ConveyorVelocity"
ConveyorVelocity.Parent = RootPart
ConveyorVelocity.Attachment0 = RootPart:FindFirstChild("Attachment")
--ConveyorVelocity.VectorVelocity = Vector3.new(Conveyor.AssemblyLinearVelocity)
print("velocity added")
Players[Object.Parent.Name] = true
end
end)
Conveyor.TouchEnded:Connect(function(Object)
if Object.Parent:FindFirstChild("HumanoidRootPart") and Players[Object.Parent.Name] then
local RootPart = Object.Parent:FindFirstChild("HumanoidRootPart")
if RootPart:FindFirstChild("ConveyorVelocity") then
RootPart:FindFirstChild("ConveyorVelocity"):Destroy()
print("velocity removed")
Players[Object.Parent.Name] = false
end
end
end)