Hello. I'm trying to make a tutorial for my game, and when I try to test it, it won't get parented to the playergui.
-- Portion of the script
if levels.Value == 1 then
print("Start tutorial") -- it prints
game.ReplicatedStorage.Remotes.StartTutorial:FireClient(player)
end
-- Client
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local tutorial = game.ReplicatedStorage.Tutorial
local runService = game:GetService("RunService")
game.ReplicatedStorage.Remotes.StartTutorial.OnClientEvent:Connect(function(player)
tutorial.Parent = playerGui -- this would be the problem I suppose
end)
if tutorial.Parent == playerGui then
for i = 1, #start do
script.Parent.TextLabel.Text = string.sub(start, 1, i)
runService.RenderStepped:Wait()
end
script.Parent.Parent.Skip.Visible = false
wait(1.5)
for i = 1, #messages[1] do
script.Parent.TextLabel.Text = string.sub(messages[1], 1, i)
runService.RenderStepped:Wait()
end
wait(1.5)
for i = 1, #messages[2] do
script.Parent.TextLabel.Text = string.sub(messages[2], 1, i)
runService.RenderStepped:Wait()
end
wait(1.5)
script.Parent.Parent.Arrow:TweenPosition(UDim2.new(0.28, 0, 0.63, 0), "Out", "Linear", 1)
for i = 1, #messages[3] do
script.Parent.TextLabel.Text = string.sub(messages[3], 1, i)
runService.RenderStepped:Wait()
end
script.Parent.Parent.Arrow.Position = UDim2.new(2, 0, 2, 0)
wait(1.5)
script.Parent.Parent.Arrow:TweenPosition(UDim2.new(0.28, 0, 0.58, 0), "Out", "Linear", 1)
for i = 1, #messages[4] do
script.Parent.TextLabel.Text = string.sub(messages[4], 1, i)
runService.RenderStepped:Wait()
end
script.Parent.Parent.Arrow.Position = UDim2.new(2, 0, 2, 0)
wait(1.5)
script.Parent.Parent.Arrow:TweenPosition(UDim2.new(0.28, 0, 0.66, 0), "Out", "Linear", 1)
for i = 1, #messages[5] do
script.Parent.TextLabel.Text = string.sub(messages[5], 1, i)
runService.RenderStepped:Wait()
end
script.Parent.Parent.Arrow.Position = UDim2.new(2, 0, 2, 0)
wait(1.5)
script.Parent.Parent.Arrow:TweenPosition(UDim2.new(0.67, 0, 0.84, 0), "Out", "Linear", 1)
for i = 1, #messages[6] do
script.Parent.TextLabel.Text = string.sub(messages[6], 1, i)
runService.RenderStepped:Wait()
end
script.Parent.Parent.Arrow.Position = UDim2.new(2, 0, 2, 0)
wait(1.5)
for i = 1, #messages[7] do -- end of tutorial
script.Parent.TextLabel.Text = string.sub(messages[7], 1, i)
runService.RenderStepped:Wait()
end
wait(0.5)
tutorial.Parent = game.ReplicatedStorage
end

3 comments
Try, in line 5, with game:GetService("ReplicatedStorage"):WaitForChild("Tutorial"). Perhaps it works
I would suggest keeping the tutorial gui in StarterGui then enabling the gui when you want the tutorial to show up.
i've moved the local script that was inside the tutorial gui to starterpack, and now it works.