NoFreefall Module | Create a similar effect to going beyond the boundaries from Mario Galaxy

I’m not sure what you mean by block form, it gets stuck (or takes a while for the character to reappear) once it reaches the waypoint.
image

This particularly happens when the waypoint is highly above the barrier.

Strange, I’ll make a tutorial video then.

2 Likes

Oh yeah, I uh also got a issue where the accessories also get collision and get your character to fly around.

1 Like

I’ll look into that, I’ve known about the flinging around problem for a bit but never really got around to fixing it. I’ll probably just rewrite the whole module once I do fix it.

UPDATE

I’ve rewritten parts of the module to reduce some of the code that wasn’t needed and it now works both on client and server. Running the module on the client will make the effects only be seen on the client, and running it on the server will make all players be able to see the effects.

I’ve also improved the noclip part of the code by completely removing it and adding the collisiongroup FreefallPlayers, where it can’t collide with the Default collision group. With this change module:CollisionSet(instance) has been removed.

I’ve updated the module and example place with this change.

4 Likes

Might wanna update this then.

1 Like

Really nice module. :slight_smile: I changed it a bit for my own use:

robloxapp-20230311-1431320.wmv (755.4 KB)

The while loop that checks for the rounded vector to equal the target position seems to hang sometimes, so I just wait for the tween and removed the while loop. I also teleport the player, make invisible and use another part for trail to avoid flinging.

Modified script for inspiration:


-- NoFreefall Rewrite
-- MisterPhilo
-- Created January 23, 2022
-- Rewritten January 15, 2023
-- More changes solsort500 March 11, 2023

local NoFreefall = {}

local TweenService = game:GetService("TweenService")
local PhysicsService = game:GetService("PhysicsService")
local BezierTweens = require(script.BezierTweens)
local Waypoints = BezierTweens.Waypoints
local SGEffects = require(script.SGEffects)
local Effects = workspace:WaitForChild("Effects")

local function poof(char)
	local poofTemplate = Instance.new("WedgePart")
	poofTemplate.Position = char:WaitForChild("HumanoidRootPart").Position
	poofTemplate.Anchored = true
	poofTemplate.CanCollide = false
	poofTemplate.Transparency = 0
	poofTemplate.CastShadow = false
	
	for i = 1, 50 do
		local Clone = poofTemplate:Clone()
		Clone.Parent = Effects
		Clone.Material = Enum.Material.SmoothPlastic
		Clone.BrickColor = BrickColor.random()
		Clone.Size=Vector3.new(math.random()*3,math.random()*3,math.random()*3)
		Clone.Name = "Effect"
		local SO = SGEffects:ScatterOut(Clone,nil,{-5, 5},0.5,{Time=0.5,Style=Enum.EasingStyle.Quad,Direction=Enum.EasingDirection.In})
		local SF = SGEffects:SizeFactor(Clone,nil,0.5,{Time=0.5,Style=Enum.EasingStyle.Quad,Direction=Enum.EasingDirection.In})
		SO:Play()
		SF:Play()
	end
	poofTemplate:Destroy()
end

local function visChar(char, value)
	for _, p in pairs(char:GetDescendants()) do
		if (p:IsA("BasePart") or p:IsA("Decal")) and p.Name ~= "HumanoidRootPart" then
			p.Transparency = value
		end
	end
end

local function bezierInfo(part, waypoints, style, direction, t)
	local newTween = BezierTweens.Create(part, {
		Waypoints = waypoints,
		EasingStyle = style or Enum.EasingStyle.Sine,
		EasingDirection = direction or Enum.EasingDirection.In,
		Time = t or 5
	})
	
	return newTween
end

function NoFreefall:Fire(char:Model,endPos:Vector3)
	if char then
		char.PrimaryPart.AssemblyLinearVelocity=Vector3.zero
		if char:GetAttribute("IsFreefall") == true then
			warn("Freefall is already active.")
			return 
		end
		char:SetAttribute("IsFreefall", true)
		local HRP = char:WaitForChild("HumanoidRootPart")
		
		local startPos = HRP.Position
		local Control = Vector3.new(startPos.X + endPos.X, endPos.Y + 200, startPos.Z + endPos.Z)/2
		local waypoints = Waypoints.new(startPos, Control, endPos)
		
		-- make a part with trail and sound for the camera to track		
		local part=Instance.new("Part")
		part.CanCollide=false
		part.CanQuery=false
		part.CanTouch=false
		part.Size=Vector3.one
		part.Position=HRP.Position
		part.Anchored=true
		part.Transparency=1
		part.Parent=workspace.Effects
		local Sound = Instance.new("Sound", part)
		Sound.SoundId = "rbxassetid://9126089328"
		Sound:Play()
		local Trail = Instance.new("Trail")
		Trail.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 255, 255)), ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 255, 255))})
		Trail.FaceCamera = true
		Trail.LightEmission = 1
		Trail.LightInfluence = 1
		Trail.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.0149, 0), NumberSequenceKeypoint.new(1, 0)})
		Trail.Enabled = true
		Trail.Lifetime = 0.5
		Trail.MaxLength = 0
		Trail.MinLength = 0.05
		Trail.WidthScale = NumberSequence.new({NumberSequenceKeypoint.new(0, 0), NumberSequenceKeypoint.new(.0379, .594), NumberSequenceKeypoint.new(.2, .856), NumberSequenceKeypoint.new(.8, .85), NumberSequenceKeypoint.new(.916, .65), NumberSequenceKeypoint.new(1, 0)})
		local attachment0 = Instance.new("Attachment", part)
		attachment0.Position = Vector3.new(1, 0, 0)
		local attachment1 = Instance.new("Attachment", part)
		attachment1.Position = Vector3.new(-1, 0, 0)
		Trail.Parent = part
		Trail.Attachment0 = attachment0
		Trail.Attachment1 = attachment1
		workspace.CurrentCamera.CameraSubject=part
		-- make a "poof" effect, hide the character and move it 
		visChar(char, 1)
		poof(char)
		char:PivotTo(CFrame.new(endPos))
		-- freeze the player
		local humanoid:Humanoid=char.Humanoid
		local walkspeed=humanoid.WalkSpeed
		humanoid.WalkSpeed=0
		task.wait(0.2)
		-- play the tween
		local tween = bezierInfo(part, waypoints,Enum.EasingStyle.Linear,Enum.EasingDirection.In,1.5)
		tween:Play()
		tween.Completed:Wait()
		-- change camera focus back, make a "poof" effect and show the character again 
		workspace.CurrentCamera.CameraSubject=humanoid
		poof(char)
		part:Destroy()
		visChar(char, 0)
		humanoid.WalkSpeed=walkspeed
		char:SetAttribute("IsFreefall", false)
	else
		warn("You didn't input a valid character instance.")
	end
end

return NoFreefall

And the localscript (characterscript) which calls the module:

local ReplicatedStorage=game:GetService("ReplicatedStorage")

local NoFreefall = require(ReplicatedStorage:WaitForChild("Scripts"):WaitForChild("NoFreefallRewrite"))

local character:Model=script.Parent
local humanoid:Humanoid = character:WaitForChild("Humanoid")

-- start bounce-back after free-falling longer than the wait()
local fallEventCounter = 0
humanoid.FreeFalling:Connect(function()
	fallEventCounter+=1
	local fcount=fallEventCounter
	wait(1.5)
	if humanoid:GetState()==Enum.HumanoidStateType.Freefall and fallEventCounter==fcount then
		NoFreefall:Fire(character,(character:GetAttribute("CheckpointPos") or workspace.SpawnLocation.CFrame.Position)+Vector3.new(Vector3.new(0,5,0)))
	end
end)
3 Likes

edit: (whoops accidently replied to the wrong person)

There is a problem where ALL the parts on my character become visible. I don’t know about this still but is there a fix for it?

image

Only whitelist body parts using tables.

1 Like