My script wont run in play mode but runs in run mode

WHAT IS THIS POST, FOR ANYBODY WHO WANTS TO KNOW WHY ITS BELOW THIS IS CRINGE

Summary

This is what i mean in run mode.






In playtest mode:

My script for the first dialog is


---Dialog--

--We wait here, and after 0.5 seconds, we wield the H part.--

wait (1)

game.Workspace.Talk.Looped = true 
game.Workspace.Talk.Playing = true 


game.StarterGui.Dialogue1.TextLabel.Text = "H" -- The first line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue1.TextLabel.Text = "He" -- The second line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue1.TextLabel.Text = "Hey" -- The third line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue1.TextLabel.Text = "Hey!" -- The fourth line of our Letter By Letter.
game.Workspace.Talk.Looped = false 
game.Workspace.Talk.Playing = false

wait (2) 

game.StarterGui.Dialogue1.Enabled = false
game.StarterGui.Dialogue2.Enabled = true

print “Dialogue 1 has disappeared”

My code for the second dialog is

---Dialog--

--We wait here, and after 0.5 seconds, we wield the H part.--

wait (3)

game.Workspace.Talk.Looped = true 
game.Workspace.Talk.Playing = true 


game.StarterGui.Dialogue2.TextLabel.Text = "I" -- The first line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue2.TextLabel.Text = "I'" -- The second line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue2.TextLabel.Text = "I'm" -- The third line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue2.TextLabel.Text = "I'm y" -- The fourth line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue2.TextLabel.Text = "I'm yo" -- The fifth line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue2.TextLabel.Text = "I'm you" -- The sixth line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue2.TextLabel.Text = "I'm your" -- The seventh line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue2.TextLabel.Text = "I'm your a" -- The eighth line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue2.TextLabel.Text = "I'm your as" -- The ninth line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue2.TextLabel.Text = "I'm your assi" -- The tenth line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue2.TextLabel.Text = "I'm your assis" -- The eleventh line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue2.TextLabel.Text = "I'm your assist" -- The 12th line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue2.TextLabel.Text = "I'm your assista" -- The fourth line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue2.TextLabel.Text = "I'm your assistan" -- The fourth line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue2.TextLabel.Text = "I'm your assistant" -- The fourth line of our Letter By Letter.

wait (0.05) -- Determines when we skip to our  next line.

game.StarterGui.Dialogue2.TextLabel.Text = "I'm your assistant!" -- The fourth line of our Letter By

Does anybody know how to fix this?

Also the GUI is supposed to go away when both say they disappeared.

1 Like

It’s changing the GUI in StarterGui, not PlayerGui. To fix this, replace all instances of game.StarterGui with script.Parent and place the script in the ScreenGui.

Ok, I see your problem. The Dialogue1 is not a valid member of itself, so you need to remove something.

What is it?
image

Dialogue1Handler thinks that Dialogue1 is inside Dialogue1, so change .Dialogue1.Dialogue1 to .Dialogue1, probably in the Find all/Replace all view.

I cant seem to find it. Any other way?

Please read because judging from your code, you need to do this ASAP! (Not trying to be mean, we were all there at some point (assuming you are new)!)

Change the script and use a local script, also if it requires like a proximity prompt or touched event in the workspace use a remote event to establish communications between server and player (client)

Or just have the touched event or proximity prompt event inside the local script, but I say remote event since you can pass through parameters and make it modular with like 10 lines of code. Also, instead of doing wait(0.05) every time just look at the roblox tutorial (ALSO DONT USE wait(X) USE task.wait(X) even if you were to do it that way!!)

Also also, use a variable to define “game.StarterGui.Dialogue2.TextLabel.Text” (local text = game.StarterGui.Dialogue2.TextLabel.Text)
so you can just do text.Text = “blalalalala”

for more info:

2 Likes

Follow up, to start just put your code in a local script, please. It will work. Things that are made for each individual player to see with differences use a local script (runs on client ((player)) instead of server)

i cant give a good explanation so do research and I hope the links i provided can help you

1 Like

And this is what I would say. But you know how hard it is to explain to them that they need to put a wait statement at the beginning?

Jokes aside, I think that everything in here has a valuable explanation on how it’s better, faster, smoother, and more reliable. If you get kicked client scripts still run? Yes.

Anyways, I think that the tutorials are a great explanation for a beginner, but I think the code itself should be more organized, too.

1 Like

Uh extra follow up btw, just do script.Parent…
Disappointed I didn’t see that sooner…
sleep deprived

In a local script

Ex: script.Parent.Dialogue2.TextLabel.Text

1 Like

Explained with the solution of using variables and you can also tell he’s trying to do a typewriter effect

God forbid imagine we lived in a roblox society where that’s required to make a type writer effect script…

Roblox has a tutorial to use their module script specifically for doing so and to make the text type write it’s as simple as 3 lines of code at most (linked at my first response)

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.