Hi, I'm making a story game and when i test the dialogue in Studio it works fine. I look in dev console on actual roblox and i get errors, saying that it can't find a frame in StarterGui that is actaully there. It does that for all the variables in my script that find things inside the Screen Gui. Help??? Tell me if you want to see the script that works the dialogue.

Here is the script for asdfghjk9019. The script is in StarterPlayerScripts. I use a remote Event and :FireAllClients to manage all the dialogue.

local player = game.Players.LocalPlayer
local CreateDialogueEvent = game.ReplicatedStorage.CreateDialogueEvent
local DialogueFrame = player.PlayerGui.ScreenGui.Main
local Rep = game.ReplicatedStorage.TurnOffDialogueFrame
local RE = game.ReplicatedStorage.TurnOnFrame
local Alt = game.ReplicatedStorage.AltitudeTime
local soundevent = game.ReplicatedStorage.playSoundEvent
local soundstop = game.ReplicatedStorage.stopSoundEvent


Alt.OnClientEvent:Connect(function()
	DialogueFrame.Parent.Altitude.Visible = true
	DialogueFrame.Parent.Altitude.Altitude.Text = "1,000 feet"
	wait(1)	
	DialogueFrame.Parent.Altitude.Altitude.Text = "900 feet"
	wait(0.9)
	DialogueFrame.Parent.Altitude.Altitude.Text = "800 feet"
	wait(0.8)
	DialogueFrame.Parent.Altitude.Altitude.Text = "700 feet"
	wait(0.7)
	DialogueFrame.Parent.Altitude.Altitude.Text = "600 feet"
	game.Workspace.Camera.CameraType = Enum.CameraType.Scriptable
	game.Workspace.Camera.CFrame = game.Workspace.Plane.CamPlane1.CFrame
	wait(2)
	game.Workspace.Camera.CFrame = game.Workspace.Plane.CamPlane2.CFrame
	wait(0.6)
	DialogueFrame.Parent.Altitude.Altitude.Text = "500 feet"
	wait(0.7)
	DialogueFrame.Parent.Altitude.Altitude.Text = "400 feet"
	wait(0.6)
	DialogueFrame.Parent.Altitude.Altitude.Text = "300 feet"
	wait(0.7)
	DialogueFrame.Parent.Altitude.Altitude.Text = "200 feet"
	wait(0.6)
	DialogueFrame.Parent.Altitude.Altitude.Text = "100 feet"
	wait(1)
	DialogueFrame.Parent.Blackout.Visible = true
	game.Workspace.CrashSound:Play()
	DialogueFrame.Parent.Altitude.Visible = false
	game.Workspace.Camera.CameraType = Enum.CameraType.Custom
	wait(0.5)
	for _, player in pairs(game.Players:GetChildren()) do
		local plr = player.Character
		plr.HumanoidRootPart.CFrame = game.Workspace.Roundabout.TeleportPad.CFrame
	end	
	wait(8)
	DialogueFrame.Parent.Blackout.Visible = false
		game.Lighting.OutdoorAmbient = Color3.new(128/255,128/255,128/255)
	game.Lighting.Brightness = 2
	game.Lighting.TimeOfDay = "14:00:00"
	game.Lighting.FogColor = Color3.new(192/255,192/255,192/255)
	game.Lighting.FogEnd = 10000
	game.Lighting.FogStart = 0
	for i,v in pairs(game.Players:GetPlayers()) do
			if v.Character then
				if v.Character.Humanoid.Sit == true then
					v.Character.Humanoid.Sit = false
				end
			end
		end
end)

RE.OnClientEvent:Connect(function()
	DialogueFrame.Visible = true
	DialogueFrame.Dialogue.Text = ""
end)

Rep.OnClientEvent:Connect(function()
	DialogueFrame.Visible = false
	DialogueFrame.Dialogue.Text = ""
end)

local function playSound(sound_id) -- Plays typing sound
	local sound = Instance.new("Sound",game.ReplicatedStorage)
	sound.SoundId = sound_id
	sound.Volume = .1
	sound.PlayOnRemove = true
	sound:Destroy()
end

local function textAnimate(content) -- Animates each letter
	for i=1,string.len(content) do
		DialogueFrame.Dialogue.Text = string.sub(content,1,i)
		playSound("rbxassetid://915576050")
		if string.sub(content,i,i) == "!" or string.sub(content,i,i) == "." or string.sub(content,i,i) == "?" then
			wait(1)
		elseif 	string.sub(content,i,i) == "," then
			wait(.5)
		else
			wait(.05)
		end
	end
end

local function textSpeaker(Talker)
	DialogueFrame.PlayerName.Text = Talker
end

CreateDialogueEvent.OnClientEvent:Connect(function(image_id, content, Talker) -- activates when called from the Server
	if not player:findFirstChild("secretEnding") then
		DialogueFrame.Speaking.Visible = true
		DialogueFrame.Speaking.Image = image_id
		DialogueFrame.Dialogue.Text = ""
		DialogueFrame.Visible = true
		textSpeaker(Talker)
		textAnimate(content)
	end
end)

Thanks, DarxMasterX

4 comments

0

are you using WaitForChild()?

0

Nope. Ill edit the question and give you the script

0

There :-)

0

That's a good idea though. I'll do that and see if it works. The whole GUI might not have loaded yet.