Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Can I Make this Cutscene work for all players?

Asked by 7 years ago
Edited 7 years ago

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)

0
Man, I don't know how to fix your Lua, but please fix your grammar. It's horrendous. SchonATL 15 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

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

0
the highlighted areas might need to be gotten rid of as they might highlight more than necessary themowerman 35 — 7y
0
thx SilverBunny_Gd -7 — 7y
Ad

Answer this question