Might as well start with answering the questions since it’s my first post…
-
What do you want to achieve? When I press a button, I want a RemoteEvent to fire causing a cutscene with dialogue to play. The RemoteEvent fires and the cutscene plays.
-
What is the issue? When the RemoteEvent fires the text will not play. The text is a scripted animation that writes itself out. This is the script I currently have
local DialogueText = script.Parent.Text
text1 = 'Will this darn thing ever work >:('
game.ReplicatedStorage.Cutscene1.OnClientEvent:Connect(function()
for i = 1, #text1 do
DialogueText = string.sub(text1, 1, i)
wait(0.05)
end
end)
wait(1)
DialogueText = ' '
- What solutions have you tried so far?
- I have tried separating the text animation and the cutscene player into two different functions which are supposed to fire at the same time
-
- Originally like this (I am posting the entire script just in case)
local TweenService = game:GetService('TweenService')
local Camera = game.Workspace.Camera
local CutsceneTime = 3
local TweenInfo = TweenInfo.new(
CutsceneTime,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local CutscenePlaying = false
local DialogueText1 = script.Parent.ScreenGui.Dialogue.Text --This is where the variables for the text animation are if you couldn't find them
text1 = 'This isnt going well :/'
function Tween(part1,part2)
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = part1.CFrame
local tween = TweenService:Create(Camera, TweenInfo, {CFrame = part2.CFrame})
tween:Play()
wait(CutsceneTime)
Camera.CameraType = Enum.CameraType.Custom
end
game.ReplicatedStorage.Cutscene1.OnClientEvent:Connect(function()
if CutscenePlaying == false then
CutscenePlaying = true
Tween(game.Workspace["Cutscene1-1"],game.Workspace["Cutscene1-2"])
wait(3)
for i = 1, #text1 do
DialogueText1 = string.sub(text1, 1, i)
wait(0.05)
end
wait(1)
DialogueText1 = ' '
CutscenePlaying = false
end
end)
-
I moved the text animation function to a separate script (It was a script, not a LocalScript) inside the TextLabel
-
Realizing my mistake when going back in my notes (I knew I was gonna forget how to do the script), I go back and change the script in the TextLabel to a LocalScript
Still, after everything, my notes failed me, and when I click the button, the cutscene will play, but the text doesn’t play.
My screen recording software is having problems so, unfortunately, I cannot give a screen recording.