How do I create a fling pad?

How would have Blockate done it for the cannon blocks… They must have used some other things. :thinking:

Guys, the answer was supper simple, just set the pad anchored and give it some velocity.

script.Parent.Touched:Connect(function(hit)
	local bv = Instance.new("BodyVelocity")
	bv.Parent = hit
	bv.Velocity = script.Parent.CFrame.UpVector * 100

	wait(.5)

	bv:Destroy()

end)

Got it to work but the method is so scuffed i refuse to take pride in it

1 Like

It is really hard to control how much you bounce though.

local Debris = game:GetService("Debris")
script.Parent.Touched:Connect(function(other: BasePart)
    local model = other:FindFirstAncestorWhichIsA("Model")
    
    -- This if statement checks if the model exists and that it is a character model.
    if model and model:FindFirstChildWhichIsA("Humanoid") then
        -- We're gonna have to do some extra work
        local humanoid = model:FindFirstChildWhichIsA("Humanoid")
        
        local velocity = Instance.new("BodyVelocity")
        velocity.Velocity = Vector3.new(0, 100, 0)
        velocity.MaxForce = Vector3.new(0, math.huge, 0) -- I am tired
        velocity.Parent = humanoid.RootPart
        
        humanoid.PlatformStand = true
        Debris:AddItem(velocity, 0.3)
        
        -- Make sure the humanoid gets up again
        task.delay(1, function()
            humanoid.PlatformStand = false
        end)
        
        return
    end
    
    -- It's not a character, so just apply an impulse to the part that hit it
    other:ApplyImpulse(Vector3.new(0, 100, 0))
end)

I got something to work.
I am mad that ApplyImpulse doesn’t work on the root part.

1 Like

YES! YOU SOLVED IT! I think it was the platform stand

It is nearly correct. Just use a parts lookvector and multiply it should look like this

script.Parent.Touched:Connect(function(getHumanoid)
  getHumanoid.Parent.HumanoidRootPart.Velocity = script.Parent.CFrame.LookVector * 100
end)

Alredy tried it, didn’t work. Apparently you can’t modify the velocity???

You can, i got this document which uses velocity to change a grenade velocity to a mouse coordinate.
How do I make physics based grenades start with velocity? - Scripting Support - DevForum | Roblox

Did you try out Bodyforce?

I’m changing the parts velocity and adding an overcomplicated debounce so brb

Yes, I did try body force, but it takes a while to do it, like 1 second

I think @Downrest had something, I will test it again to see if it works. I think it went up but maybe we could alter that coding to fling outwards.

local debounce = {}

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:IsA("Model") then
		if table.find(debounce, hit.Parent.Name) then
			return
		end
	else
		if table.find(debounce, hit.Name) then
			return
		end
	end
	if hit.Parent:IsA("Model") then
		table.insert(debounce, hit.Parent.Name)
	else
		table.insert(debounce, hit.Name)
	end
	script.Parent.Velocity = script.Parent.CFrame.UpVector * 500
	wait(.5)
	script.Parent.Velocity = Vector3.new(0,0,0)
	if hit.Parent:IsA("Model") then
		table.remove(debounce, table.find(debounce,hit.Parent.Name))
	else
		table.remove(debounce, table.find(debounce,hit.Name))
	end
end)

WHY DID THiS TAKE SO LONG

5 Likes

! @Snowy_Bacn YOUR A LEGIT ROBLOX EINSTEIN 0-0

1 Like

I also found another solution, the velocity can only be modified in a character script

pad.Touched:Connect(function(part)
	local model = part:FindFirstAncestorOfClass("Model");
	if(model  == script.Parent) then
		script.Parent.PrimaryPart.Velocity = pad.CFrame.LookVector * 100;
	end;
end);

Thats unreliable because of how touched fires, which is why i added a debounce to that

btw i think you have an error because you put if model == script.Parent

Edit: nvm I see it now, I just got confused because u showed a snipet

Oh but then it is basicly the same solution

the parent of the script is the player