Quantcast

[REDONE] - Flood Escape 2 Scripting Tutorial!

Ok, so here we are again, I’ve decided to revamp my scripting tutorial! If you would like any scripts added just message or reply!

Credit: Credit goes to: Veryfakeguest, GradimirKarpiuk for some scripts (e.g. Walk speed, hint, UI, and Message etc)

NOTE: Before Anything, You Must Have These 2 Lines Of Code In Your Script! (You Can Use EventScript or EventString), But these lines of code must be in the script

local Lib = workspace.Multiplayers.GetMapVals:Invoke() -- Since It’s A Bindable Function
Lib.Button:Connect(function(p,bNo)
    if Lib.BtnFuncs[bNo] then
        Lib.btnFuncs[bNo](p,bNo)
    end
end

Ok, after that’s done, here’s the starting of scripting:

Moving Water

To Move Water, Use This

Lib.Script.moveWater(Lib.Map._Water1, Vector3.new(0,20,0),10,true)

Now lemme explain

Lib.Script.moveWater is the moving water function
Lib.Map._Water1 is where the water is,
Vector3.new(0,20,0) is how far it moves (in this case 20 studs upwards)
true is if the move is in world space or local space (recommend as true for now)

Using TweenService (Opening Door)

To use tween service, it is a way of animating objects, here is how you can make an opening door:

local TweenService = game:GetService(“TweenService”)
local Door1 = Lib.Map.Door1
local TweeningInfo = tweenInfo.new(
2, -- Time
Enum.EasingStyle.Bounce, -- Easing Style (How It Will Tween)
Enum.EasingDirection.Out, -- The Direction Of Tween (I recommend you use OUT since the others don’t work well
0, -- Times To Repeat
false, -- If The Tween Reverses
0 -- Delay Between Each Tween
)

-- NOTE: The Repeating Times, Reversing, And Delay Is OPTIONAL

local TweenGoals = {
    CFrame = Door1.CFrame + Vector3.new(10,0,0)
}

local Tween = TweenService:Create(Door1, TweeningInfo, TweenGoals):Play()

Or the short way

game:GetService(“TweenService”):Create(
    Lib.Map.Door1, TweenInfo.new(2, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out, 0, false, 0), -- The Repeating, Reversing, And Delay Is OPTIONAL
{CFrame = Lib.Map.Door1.CFrame + Vector3.new(10,0,0)}):Play()

Note: You Are Able to change the easing styles.

Making A Floating Raft

So here’s how, make a model and call it raft, then insert another model inside that and that is the raft, so this is how it should look

Workspace > Raft > RaftModel

local Raft = Lib.Map.Raft:GetChildren()

for _,v in pairs(Raft) do
    if v:IsA("Model") then
        local mainCFrame = v:GetPrimaryPartCFrame()
        spawn(function()
            while game:GetService("RunService").Heartbeat:Wait() do
                local sin, rad = math.sin, math.rad
                local t = tick()
                local newCFrame = mainCFrame * CFrame.new(sin(t * 2) * 1, sin(t * 0) * 0, sin(t * 0) * 0)
                v:SetPrimaryPartCFrame(newCFrame)
            end
        end)
    end
end
How To Set Water States

To Set Water States, Use This Line Of Code
Lib.Script.setWaterState(Lib.Map._Water1, **State**)

States Must Be Set As “water”, “acid” or “lava”

Button Functions

To Make A Button function, Use this script:

Lib.btnFuncs[ButtonNumber] = function()
--Code In Here
end
Converting To Event String

Now This Might be more Tricky, but we can do it!

So What you want to do is select these lines of code and press “CTRL + H”

local btnPress = game.ServerStorage.Bindables.BtnPress

local btnFuncs = {}

btnPress.Event:Connect(function(plr, btnNo)
    if btnPress[btnNo] then
        btnFuncs[btnNo] (btnNo, plr)
    end
end)

Now It Will Come Up With A “Find And Replace”, the top bar should now be filled in with the code you highlighted, in the bottom bar, paste this

local Lib = workspace.Multiplayer.GetMapVals:Invoke()
Lib.Button:connect(function(p, bNo) if Lib.btnFuncs[bNo] then Lib.btnFuncs[bNo](bNo, p) end end)

Now, click the bottom bar and press ENTER, the text should get replaced
Once done, in the top bar, put in btnFuncs, and in the bottom bar, put Lib.btnFuncs

Now for the big part, in the top bar, put mapScript, in the bottom bar, put Lib.Script
BUT, we are not done yet, in the top bar, put script.parent, and in the bottom bar, put Lib.Map

Pulsing

Now To Do Pulsing, insert this script BEFORE, any button functions, insert this code

spawn(function()
	while true do
		game:GetService(“TweenService”):Create(
		Lib.Map.PulsingPart1, TweenInfo.new(3.6,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),
		{Color = Color3.fromRGB(255,255,255)}):Play()
		wait(2)
		Lib.Map.PulsingPart1.Color = Color3.fromRGB(255,0,0)
	end
end)

NOW THIS Looks Like HELL!, but it actually isnt, let me explain

game:GetService(“TweenService”:Create( – This gets The Tween service to create the pulse

Lib.Map.PulsingPart1, Tweeninfo.new(T, ES, ED) – This Is The Time, Easing Style, And Direction of the pulse, i recommend you set Ease Style to Linear, and ease direction to InOut

{Color = Color3.fromRGB(255,255,255)}):Play() – This Is The Part Property to change, you can change CFrame, Size, Color, Transparency, etc, NOTE:, This Is The Property it will fade to, so it fades to the color white (255, 255, 255)

wait(2)
Lib.Map.PulsingPart1.Color = Color3.fromRGB(255,0,0) - this makes the part flash and it then starts the tween!

Conveyors

For A Conveyor, insert this simple but effective script

while wait() do
    Lib.Map.CoveyorName.Velocity = Lib.Map.ConveyorName.CFrame.lookVector * X
end

Note: The Higher X Is, the faster the conveyor

Teleporter Script - WITH EFFECT!

To Make a teleport script, first, insert 2 parts and make them canCollide False, then insert this script:

Lib.Map.TeleporterStart.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild(“Humanoid”) then
        local Character = hit.Parent
        local ColorCorrection = Instance.new(“ColorCorrectionEffect”, game.Lighting)
        ColorCorrection.Brightness = 1
        game:GetService(“TweenService”):Create(
            ColorCorrection, TweenInfo.new(1.75, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
        {Brightness = 0}):Play()
        Character:SetPrimaryPartCFrame(Lib.Map.TeleporterEnd.CFrame)
        ColorCorrection:Destroy()
    end
end)
Flash Script

To do a flash, use this

To Repeat Once

Lib.Map.Part.Transparency = 1
wait(0.5)
Lib.Map.Part.Transparency = 0
**Or To Repeat Forever**
while true do
    Lib.Map.Part.Transparency = 1
    wait(0.5)
    Lib.Map.Part.Transparency = 0
end

Or if you want it to repeat a certain amount of times

for i = 1,#Times do
    Lib.Map.Part.Transparency = 1
    wait(0.5)
    Lib.Map.Part.Transparency = 0
end
Unanchored / Anchored Script

To make a part Unanchored, do this:

Lib.Map.Part.Anchored = false

Or to make a part anchored (probably not useful), do this:

Lib.Map.Part.Anchored = true

Making A Function When A Part Is Touched

To Make this, use this script:

Lib.Map.Part.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        >--Script here
    end
end)
Custom Tweening

To Do A Custom tween, use this function:

function Tween(Part, TimeForTween, EaseStyle, EaseDirection, Property, PartProp)
    local TweenService = game:GetService(“TweenService”)
    local TI = TweenInfo.new(
    TimeForTween,
    Enum.EasingStyle[EaseStyle]
    Enum.EasingDirection[EaseDirection]
    0,
    false,
    0
    )
    local PP = {
    [Property] = PartProp
    }
    local TweenPlay = TweenService:Create(Part, TI, PartProperty)
    TweenPlay:Play()
end)
Material Changer

To change materials use this script:

Lib.Map.Part.Material = Enum.Material.(Material Here)

Spawn(function) Usage

to use spawn function, its pretty easy, do this:

spawn(function()
    >--Code Here
end)
Lerping!

Lerping is when you use the game physics to move a parts CFrame (position) to another position, to do this, use this script as it is the easiest way to do it

for i = 0, 1, **0.01** do
    wait()
    Lib.Map.Part.CFrame = Lib.Map.Part.CFrame:lerp(Lib.Map.Part2.CFrame, I)
end

then the part should move, also take note that 0.01 is in bold, this is the increments, so i starts at 0, then goes up in increments of 0.01, the bigger the increments are, the faster the lerp

Color Change

To Color change use this function

Lib.Map.Part.Color = Color3.fromRGB(redVal, greenVal, blueVal)

Property: CanCollide

To disable can collide, use this

Lib.Map.Part.CanCollide = false

Part Transparency Pulse
spawn(function()
Lib.Map.Part.Transparency = 1
game:GetService(“TweenService”):Create(
    Lib.Map.Part, TweenInfo.new(1, Enum.EasingStyle.Linear,    Enum.EasingDirection.InOut),
    {Transparency = 0}):Play()
end)

To make button function put this code inside a Lib.btnFuncs Script

Rotating Parts

Now this doesn’t require any :SetPrimaryPartCFrame() stuff or any of that, just use this script!

spawn(function()
    wait(3)
    for _,v in pairs(Lib.Map.RotateRoom1:GetChildren()) do
        game:GetService(“TweenService”):Create(
            v, TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut),
        {Orientation = Vector3.new(X,Y,Z)}):Play()
    end
end)
Timing Music To The Beat

Ok, to do this, all you need to know is the BPM Of the song:

How To Get The BPM

  1. Go To This Site, Then Get The Link Of Your Song, Download It, Then Go To This Site, And get the bpm!

Once Done, Use This

local BPM = 120 -- BPM Here
local Beat = (60 / BPM)

function WaitForBeat(BeatNumber)
    Wait(Beat * BeatNumber(
end

WaitForBeat(5) -- Done! It Waits 5 Beats!
No Jump Script!

This script allows all players in your map to not jump!

for _,v in pairs(game:GetService("Players"):GetChildren()) do
    local Character = v.Character
    local Humanoid = Character:FindFirstChildOfClass(“Humanoid”)
    if Character and Humanoid then
        Humanoid.JumpPower = 0
    end
end
Lightning Strike

This Is Basically Creating a part and tweening it lol, heres how

function InitiateLightning(partToStrike, duration)
   spawn(function()
        local Pos = partToStrike.Position
        local Strike = Instance.new("Part", partToStrike)
        Strike.Material = Enum.Material.Neon
        Strike.Size = Vector3.new(10,500,10)
        Strike.Position = partToStrike.Position
        Strike.Anchored = true

        Strike.Touched:Connect(function(hit)
            if hit.Parent:FindFirstChild("Humanoid") then
                hit.Parent.Humanoid.Health = 0
           end
       end

       game:GetService("TweenService"):Create(
            Strike, TweenInfo.new(
                duration, 
                Enum.EasingStyle.Quad,
                Enum.EasingDirection.Out,
                0,
                false,
                0
                ),
                {Transparency = 1;
                Size = Vector3.new(0,0,0)}):Play()
            partToStrike.CanCollide = false
            part:Destroy()
            strike:Destroy()
    end)
end
ColorCorrectionEffect

To make a screen flash, use this

local ColorCorrection = Instance.new(“ColorCorrectionEffect, game.Lighting)

spawn(function()
    while true do
        ColorCorrection.TintColor = Color3.fromRGB(255,0,0)
        game:GetService(“TweenService”):Create(
            ColorCorrection, TweenInfo.new(0.5),
        {TintColor = Color3.fromRGB(255,255,255)}):Play()
        wait(1)
    end
end)

spawn(function()   
    workspace.Multiplayer.ChildRemoved:Connect(function()
        ColorCorrection:Destroy()
    end)
end)
Alert Function (Fixed)

Simple script,

game:GetService(“ReplicatedStorage”).Remote.Alertt:FireAllClients(“Blahblah”, Color3.fromRGB(255,0,0), false, false)

-- Change “Alert” To “Notify” for a big pop up, but make it in this format: Text,nil,nil
Black Bar At Top + Grey UI In Middle

To make a black bar, do this:

local UI = Instance.new(“Hint”, Lib.Map)
wait(5)
UI:Remove()

To make a grey message in the middle, replace ”Hint” with ”Message”

Typewriting Text

To make a typewritten text, do this: (this is being used in the Hint)

local UI = Instance.new(“Hint”, Lib.Map)
local Text = “Your Random Text Here”
local Length = string.len(Text) or #Text
for i = 1, Length, 1 do
    UI.Text = string.sub(Text, i, 1)
    wait(0.04)
end
wait(Length * 0.04)
for i = Length, 0, -1 do
    UI.Text = string.sub(Text, i, 1)
    wait(0.04)
end
wait(Length * 0.04)
UI:Remove()
Timed Script

To make a timed script, do this:

spawn(function()
    wait(...)
    -- Script Here
end)
StringValue Changer

To make a string value change, do this:

local Part = Lib.Map.Part
local StringVal = Part:FindFirstChildWhichIsA(“StringValue”)
if StringVal then
    Part.Touched:Connect(functon(hit)
        if hit.Parent:FindFirstChild(“Humanoid”) then
            StringVal.Value = -- Value Here (In String - “Hello”)
        end
    end
end

Newest Update: Added A Effect To Teleporter, And 2 New Scripts!
12 Likes

add tweening pl0x!!!

2 Likes

to do tween you must do tween!!!

3 Likes

i know!!! im noob at scripting ok!!! i only know how to move water, do btnfuncs, make camera shake, change property, do onTouch function, do functions, use local, use :destroy(), :reverse(), use game.Players.LocalPlayer, and workspace!!!

1 Like

destroy ez!!!

you select part then do destroy!!

script.Parent.Part:Destroy()

now part gone you wanna go with part??!

2 Likes

i know :destroy() ez!!! just wanted to flex ok!!!

2 Likes

Part scripts aren’t allowed anymore btw

2 Likes

what is part scripts again

like

:Destroy(), :Clone(), etc?

1 Like

No adding scripts inside of parts

2 Likes

like

scripts inside things?

1 Like

Yes, also any script suggestions?

2 Likes

but i insert a scirpt inside a surfacelight and it works

2 Likes

Hmm ok then maybe they are back, but I don’t recommend using them as they can lag tons

1 Like

umm, crazy brought them back on eventscript update

2 Likes

will there be more scripts soon? i only see the water script

2 Likes

@Kriscross102RBLX how to make opening door with tweenservice in eventscript

2 Likes

Suggestion: how to create FE2 game

2 Likes

Oof I can’t lmao

2 Likes

@Kriscross102RBLX can i rename to mapscript?

game:GetService(“TweenService”):Create(
mapScript._Door1, TweenInfo.new(2, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out, 0, false, 0),
{CFrame = mapScript._Door1.CFrame + Vector3.new(0,-13,0)}):Play()

2 Likes

No I’ll do it after

1 Like