Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How Can I Make this Cutscene work for all players?

The script below only works for one player after that it does not work for anyone.I was wandering how can i fix it. chat is just a gui thats for cut scenes. Thanks in advance.

par = true

script.Parent.Touched:connect(function(hit)
if par == true then
	par = false
local name = hit.Parent.Name
	print(name)
local plr = game.Players:FindFirstChild(name)
local char = plr.Character
local chat = plr.PlayerGui.Chat1
local label = chat.Frame.TextLabel
chat.Enabled = true
char.Humanoid.WalkSpeed = 0
local text = "Mom: Son your late, Professor Oak is Waiting for you"
for i = 1, #text do 
	label.Text = string.sub(text, 1, i)
wait()
end
wait(3)
local text1 = "Ok Mom"
for i = 1, #text1 do 
	label.Text = string.sub(text1, 1, i)
wait()
end
wait(3)
local text2 = "Mom: Hurry your already an hour late"
for i = 1, #text2 do 
	label.Text = string.sub(text2, 1, i)
wait()
end
wait(3)
local text3 = "Ok I guess i got to go Now!"
for i = 1, #text3 do 
	label.Text = string.sub(text3, 1, i)
wait()
end
wait(3)
local text4 = "Mom: you better"
for i = 1, #text4 do 
	label.Text = string.sub(text4, 1, i)
wait()
end
wait(3)
chat.Enabled = false
char.Humanoid.WalkSpeed = 20
end
	end)

1 comment

0

Man, I don't know how to fix your Lua, but please fix your grammar. It's horrendous.

1 answer

This will be a lil long to explain but basically this is a big solution for a small problem which can be quite basic, just paste the following code:

par = true

script.Parent.Touched:connect(function(hit) if par == true then par = false for i,plr in ipairs(game.Players:GetPlayers()) do print(plr.Name) -- same result as printing hit.Parent.Name, but it will print everyones name coroutine.resume(coroutine.create(function() local char = plr.Character local chat = plr.PlayerGui.Chat1 local label = chat.Frame.TextLabel chat.Enabled = true char.Humanoid.WalkSpeed = 0 local text = "Mom: Son your late, Professor Oak is Waiting for you" for i = 1, #text do label.Text = string.sub(text, 1, i) wait() end wait(3) local text1 = "Ok Mom" for i = 1, #text1 do label.Text = string.sub(text1, 1, i) wait() end wait(3) local text2 = "Mom: Hurry your already an hour late" for i = 1, #text2 do label.Text = string.sub(text2, 1, i) wait() end wait(3) local text3 = "Ok I guess i got to go Now!" for i = 1, #text3 do label.Text = string.sub(text3, 1, i) wait() end wait(3) local text4 = "Mom: you better" for i = 1, #text4 do label.Text = string.sub(text4, 1, i) wait() end wait(3) chat.Enabled = false char.Humanoid.WalkSpeed = 20 end end) par = true -- your issue which kept it from replaying :D end)) end

2 comments

0

the highlighted areas might need to be gotten rid of as they might highlight more than necessary

0

thx

This discussion is preserved as it was. New answers, comments, and votes are closed.