How can I make a platform throw a player off it?

In the while loop, (Which is the part when the platform spins fast), I want the player to be thrown off of it if the player steps on it. How would I achieve this?

while true do
	wait(3)
	script.Parent.Orientation = script.Parent.Orientation+ Vector3.new(0,2.5,0)
	wait(.01)
	script.Parent.Orientation = script.Parent.Orientation+ Vector3.new(0,2.5,0)
	wait(.01)
	script.Parent.Orientation = script.Parent.Orientation+ Vector3.new(0,2.5,0)
	wait(.01)
	script.Parent.Orientation = script.Parent.Orientation+ Vector3.new(0,2.5,0)
	
	wait(.8)
	
	script.Parent.Orientation = script.Parent.Orientation+ Vector3.new(0,2.5,0)
	wait(.01)
	script.Parent.Orientation = script.Parent.Orientation+ Vector3.new(0,2.5,0)
	wait(.01)
	script.Parent.Orientation = script.Parent.Orientation+ Vector3.new(0,2.5,0)
	wait(.01)
	script.Parent.Orientation = script.Parent.Orientation+ Vector3.new(0,2.5,0)
	
	wait(.8)
	local Num = 12
	
	while Num >= 0 do
		script.Parent.Orientation = script.Parent.Orientation+ Vector3.new(0,25,0)
		wait(0.00000000000000001)
		Num-= 1
	end

	
end

You can probably set the Player’s HumanoidRootPart Velocity really high and have the Part be animated

1 Like

Does Velocity use Vector3.new()?

Yes, but i believe you can do something like this:

HumanoidRootPart.Velocity = Part.CFrame.LookVector * 100

I ended up with this:

while Num >= 0 do
		script.Parent.Orientation = script.Parent.Orientation+ Vector3.new(0,25,0)
		wait(0.00000000000000001)
		Num-= 1
		script.Parent.Touched:Connect(function(hit)
			if hit.Parent:FindFirstChild("Humanoid") then
				hit.Parent.HumanoidRootPart.Velocity = script.Parent.CFrame.LookVector * 100
			
			end
		end)
	end

Nothing but lag happens. The player glitches around when it tries to move.

Use for loops.

local Part = script.Parent

for i = 1, 7 do
    Part.Orientation += Vector3.new(2.5)
end

Use task.wait()

That is very bad, you should not use connections in while loops.

Use AssemblyLinearVelocity, Velocity is deprecated.

Also, I assume you want to fling them upwards and forwards so you should also use UpVector

for i = Num, 0, -1 do -- This means : Start at Num, go to 0, with a step of -1
	task.wait()

	Part.Orientation += Vector3.new(0,25,0)

    for _, Touching in workspace:GetPartsInPart(Part) do
        if game.Players:GetPlayerFromCharacter(Touching.Parent) then
            Touching.Parent.HumanoidRootPart.AssemblyLinearVelocity = (Part.CFrame.UpVector * 100) + (Part.CFrame.LookVector * 100)
        end
    end
end
1 Like

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