Hello, and thank you for reading! This is our client:
Client:
local player = game.Players.LocalPlayer local CreateDialogEvent = game.ReplicatedStorage.CreateDialogEvent local DialogFrame = player.PlayerGui.DialogGUI:WaitForChild("DialogFrame") local DialogGUI = DialogFrame.Parent local DialogText = DialogFrame:WaitForChild("DialogText") local OriginalSound = script:WaitForChild("Talk") local TEXT_INTERVAL = 0.075 local function playSound(soundID) local Sound = OriginalSound:Clone() Sound:Destroy() end local function Talk(Text) for i = 1, string.len(Text) do DialogText.Text = string.sub(Text,1,i) playSound() if string.sub(Text,i,i) == "." or string.sub(Text,i,i) == "!" or string.sub(Text,i,i) == "?" then wait(.5) elseif string.sub(Text,i,i) == "," then wait(.1) else wait(TEXT_INTERVAL) end end end CreateDialogEvent.OnClientEvent:Connect(function(imageID,Text) if not player:FindFirstChild("secretEnding") then DialogFrame.DialogImage.Image = imageID DialogText = "" DialogGUI.Enabled = true Talk(Text) end end)
It is located in StarterCharacterScripts.
Now, I understand this error: Text is nil, as it doesnt exist, BUT, I have no other way to access it! There is a RemoteEvent inside ReplicatedStorage called CreateDialogEvent.
Server:
local Sound = script:WaitForChild("Talk") local TEXT_INTERVAL = 0.03 local CreateDialogEvent = game.ReplicatedStorage.CreateDialogEvent local randomPlayerName local randomPlayerID local function getPlayerImage(playerID) local content,isReady = game:GetService("Players"):GetUserThumbnailAsync(playerID,Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420) return content end local function getRandomPlayers() local Players = game.Players:GetPlayers() local number = math.random(1,#Players) local randomPlayer = Players[number] randomPlayerName = randomPlayer.Name randomPlayerID = randomPlayer.UserId end local function challengingExample() local Cab_Image = "rbxassetid://6927695957" CreateDialogEvent:FireAllClients(Cab_Image,"Dialog") wait(5) getRandomPlayers() CreateDialogEvent:FireAllClients(getPlayerImage(randomPlayerID,"Dialog 2")) end challengingExample() -- Ignore the rest, I used this in the past but its here just incase. --Talk("Loading...") --wait(10) --Talk("Urghh...") --wait(6) --Talk("Where are we?") --wait(8) --Talk("CAB!!!") --wait(4) --Talk("...") --wait(4) --Talk("We have to find help!")
So, that about wraps things up.
Thank you for reading, and, as always, any further questions can be answered politely!