#Dialouge Cutscene Help

3 messages · Page 1 of 1 (latest)

dim stream
#

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")

local camera = workspace.CurrentCamera
local cutsceneThings = workspace.CutsceneThings
local cutsceneStorage = ReplicatedStorage:WaitForChild("CutsceneStorage")

local sceneGui = script.Parent.Parent

local function setup()
camera.CameraType = Enum.CameraType.Scriptable
camera.FieldOfView = 60

sceneGui.Enabled = true
script.Music:Play()

end

local function positionCamera(pos)
camera.CFrame = pos
end

local function tweenCamera(endPos, tweenTime)
local camTween = TweenService:Create(camera, TweenInfo.new(tweenTime), {CFrame = endPos})
camTween:Play()
end

local function positionRig(rig, target)
rig.Parent = workspace
rig.PrimaryPart.CFrame = target
end

local function moveRig(rig, target)
rig.Humanoid:MoveTo(target.Position)
end

local function animateRig(rig, animation, toggle)
if toggle == true then
if rig and animation then
if rig.Humanoid then
animation:Play()
end
end
elseif toggle == false then
if rig and animation then
if rig.Humanoid then
animation:Stop()
end
end
end
end

#

local function setText(label, msg, color)
sceneGui.Text[label].Text = msg

if color then
    sceneGui.Text:FindFirstChild(label).TextColor3 = color
end

end

local function typeText(label, msg, typeTime, color)
if color then
sceneGui.Text:FindFirstChild(label).TextColor3 = color
end

for i=1, #msg do
    sceneGui.Text[label].Text = string.sub(msg, 1, i)
    wait(typeTime / #msg)
end

end

setup()
positionCamera(cutsceneThings.AvatarCam.CFrame)
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
positionRig(player.Character, cutsceneThings.AvatarPos.CFrame)
setText("CharacterName", "Jeffrey", Color3.new(1, 1, 1))
typeText("CutsceneText", "So what are we going to do about, ".. character.Name, .1, Color3.new(1, 1, 1))
wait(5)
tweenCamera(cutsceneThings.AvatarCam3.CFrame, 0.25)
setText("CharacterName", "Jeffrey", Color3.new(1, 1, 1))
typeText("CutsceneText", "What is it?", .1, Color3.new(1, 1, 1))
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
wait(5)
tweenCamera(cutsceneThings.AvatarCam2.CFrame, 0.25)
setText("CharacterName", "Ed", Color3.new(0.313725, 0.313725, 0.313725))
typeText("CutsceneText", "I will fight, ".. character.Name, .6, Color3.new(0.313725, 0.313725, 0.313725))
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
wait(5)
TweenService:Create(sceneGui.Frame, TweenInfo.new(1), {BackgroundTransparency = 0}):Play()
sceneGui.Text.Visible = false
script.Music:Stop()
wait(5)
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = humanoid
camera.FieldOfView = 70
TweenService:Create(sceneGui.Frame, TweenInfo.new(1), {BackgroundTransparency = 1}):Play()
character.HumanoidRootPart.CFrame = workspace.GameFolder.PlayerSpawn.CFrame
wait(1)
humanoid.WalkSpeed = 16
humanoid.JumpPower = 50
ReplicatedStorage.Remotes.JoinGame:FireServer()
sceneGui.Enabled = false
for i, v in pairs(workspace.CutsceneGameFolder:GetChildren()) do
if v:IsA("Model") or v:IsA("Part") then
v:Destroy()
end
end

#

sceneGui.Parent.GameGui2.Enabled = true
sceneGui.Parent.TimerGui.Enabled = true
script.Disabled = true