[SOLVED] How can I make this possible?

Hi,

I would like to know how I can throw the player when he touches a part. I kept trying but I didn’t succeed and I decided that maybe the forum can help me.

1 Like

You’re going to need to use a BodyThrust after a .Touched event

BodyThrust Wiki

https://github.com/PhoenixAceVFX/Roblox-Scripts/blob/master/Fe%20Fling.lua Here’s a resource that might help.

Sure!

Again, as usual, I will pull code from BaseAdmin.

t.fling = {function(Player, plr)
	for _, p in pairs(getPlayerRun(Player, plr)) do
		if p.Character then
			local pp = p.Character.PrimaryPart
			if pp then
				local h = p.Character:FindFirstChildWhichIsA("Humanoid")
				if h then
					h.Sit = true
				end
				pp:SetNetworkOwner()
				pp.AssemblyLinearVelocity += Vector3.new(200, 200, 0)
				delay(1, function()
					pp:SetNetworkOwnershipAuto()
				end)
			end
		end
	end
end, "Fling", '<plr>', 2}

This is the fling command.

So, what I have found, is that the NetworkOwner of the player should be set to the server unless you’re doing this from the client. When set to the server, the Humanoid should be either in the PlatformStand or Sit state, as these states will usually prevent physics glitches.

As this solution suggests BodyThrust, I would not recommend it. BodyThrust was deprecated.

But, I will tell you how to put this together:

part.Touched:Connect(function(hit)
local h = hit.Parent:FindFirstChildWhichIsA("Humanoid")
local pp = hit:GetRootPart()
if not pp then return end
				if h then
					h.Sit = true
				end
				pp:SetNetworkOwner()
				pp.AssemblyLinearVelocity += Vector3.new(200, 200, 0)
				delay(1, function()
					pp:SetNetworkOwnershipAuto()
				end)
end)

This should get you some results.

1 Like

I never knew that, my bad if I was giving something away no longer used

1 Like

Thank you! I have been trying for so long to figure out