How do I make a fling pad that flings players? | Version 2

Hello, I am Rbl0xGaMer949. I have previously posted about this topic, but the answer did not work. I am looking for a pad that flings people when they hit the surface, kind of like the fling blocks in the game Blockate.

  • Issue

This was previously solved in my old post, but the solution did not work once added in-game. The fling pad does not fling the player outwards when the player hits the pad.

  • Tried Solutions

I have tried altering codes from free models and tried the developer forum answer but none work, and the answer broke.

  • Examples

Footage by @Snowy_Bcn

I do not want this to boost him in the sky, I want him to get flung in the direction of the pad’s face.

Try this local script. it goes under starter player scripts and gets the parts as a table. It flings the player in the direction the part is facing.

-- CONFIGURATION
local JUMP_PAD = {workspace.Part} -- As a table *There can be multiple (a,b,c)*
local BOOST_POWER = 100 -- Studs
local BOOST_SUSTAIN_TIME = 0.02 -- Seconds
local COOLDOWN_TIME = 0.5 -- Seconds
local DELAY_TIME = 0 -- Seconds


-- LOCAL VARIABLES
local PLAYERS = game:GetService("Players")
local DEBRIS = game:GetService("Debris")
local PLAYER_COLLECTION_TABLE = {}
local INF = math.huge
local PAD_BOOST = Vector3.new(INF,INF,INF)


-- FUNCTIONS
local function ON_TOUCHED(PART, HIT)
	if HIT.Parent:FindFirstChildWhichIsA("Humanoid") then
		local CHARACTER = HIT.Parent
		local PLAYER = PLAYERS:GetPlayerFromCharacter(CHARACTER)

		if not table.find(PLAYER_COLLECTION_TABLE[PART],CHARACTER) then
			table.insert(PLAYER_COLLECTION_TABLE[PART], CHARACTER)

			local NEW_BOOST = Instance.new("BodyVelocity")
			NEW_BOOST.MaxForce = PAD_BOOST
			NEW_BOOST.Velocity = PART.CFrame.LookVector*BOOST_POWER

			task.delay(DELAY_TIME, function()
				NEW_BOOST.Parent = CHARACTER.HumanoidRootPart
				DEBRIS:AddItem(NEW_BOOST, BOOST_SUSTAIN_TIME)

				task.wait(COOLDOWN_TIME)

				table.remove(PLAYER_COLLECTION_TABLE[PART], table.find(PLAYER_COLLECTION_TABLE[PART],CHARACTER))
			end)
		end
	end
end

for _, CHILD in pairs(JUMP_PAD) do
	PLAYER_COLLECTION_TABLE[CHILD] = {}

	CHILD.Touched:Connect(function(HIT)
		ON_TOUCHED(CHILD, HIT)
	end)
end

Alternatively, you could set the part’s velocity to part.AssemblyLinearVelocity = part.CFrame.LookVector * FLING_POWER and anchor it. Whenever a player touches it, they will fly in the direction the part is facing. This is much simpler than using a long script. I assume the video is your goal?

That is correct. The video demonstrated the needed fling.

FLING.rbxl (25.7 KB)

2 Likes

IT WORKED!!! :smiley: IT LITERALLY SAVED THE GAME OMG BRO TY SO MUCH!!! :exclamation: :exclamation: :exclamation: