i need a player to get flung really far away once they touch a certain block.
You can use BodyForce like i did in a minigame I made called "The Sweeper".
1 | script.Parent.Touched:connect( function (hit) |
2 | if game.Players:FindFirstChild(hit.Parent.Name) then |
3 | local B = Instance.new( "BodyForce" ,hit.Parent.HumanoidRootPart) |
4 | B.Force = Vector 3. new( 3000 , 3000 , 5000 ) -- You can change the force however you want it to be. |
5 | end |
6 | end ) |
Try this:
1 | script.Parent.Touched:Connect( function (hit) |
2 | local root = hit.Parent:FindFirstChild( 'HumanoidRootPart' ) |
3 | local player = game.Players:GetPlayerFromCharacter(root.Parent) |
4 | if root and player then |
5 | root.Anchored = true -- allow to change the part's velocity |
6 | root.CFrame = CFrame.new(script.Parent.Position, root.Position).lookVector * 500 |
7 | root.Anchored = false -- allow the part to move |
8 | end |
9 | end ) |