How should I make a conveyor without collisions?

I’m making a wind passage type ability that creates a conveyor that pushes people forward. Since using AssemblyLinearVelocity requires collisions to be on, I just apply/remove velocity with touched/touchended.

This has a couple issues though:

  • It only works normally in 1 direction (because that’s where it’s facing obv) but any other direction only somewhat works but still has a bit of drag to the wrong side.
  • Making it relative to Attachment1 has a weird interaction with touch/touchended, making them fire constantly which really sucks.

How would I make the LinearVelocity apply in the correct direction?

local Conveyor = script.Parent
local Velocity = script.LinearVelocity
local Attachment = script.Parent.ConveyorAttachment
local Players = {}

local ServerScriptService = game:GetService("ServerScriptService")
local CooldownModule = require(ServerScriptService.CooldownModule)

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.Attachment1 = Attachment
		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)
1 Like

Try using the LookVector of the conveyor!

Attachment1 already lines it up for me (for the most part, idk why it’s slightly off) but I don’t know how to turn a LookVector into a Vector3 of a consistent force value (0,0,50 in this case)

image
I added this to your code and it works! (Sorry for late response, took me forever to realise that the player is supposed to be forced to move in a specific direction. without being able to move left or right-) Edit: Just realised you need to replace the 10 with “Velocity.VectorVelocity”

I’m only reading your title but couldn’t you use collision groups? Basically it’s where an object can only collide with certain other objects. I’ll read your post more after replying this if this is wrong.

coolio, yeah making it relative to World and just setting it to the lookvector was a way simpler solution lol

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.