To ensure that they’re running on the same thread, you can simply use RunService.Heartbeat instead of using this while wait() do
,
ServerScript:
RunService.Heartbeat:Connect(function()
local Text = ""
for i = 1,30 do
Text = Text..string.char(math.random(97,122))
end
print(Text .. " | Server")
TitanKey:FireClient(Player, Text)
end)
ClientScript:
local TitanEvent = game.ReplicatedStorage:WaitForChild("TitanEvent")
local KeyVar = ""
TitanEvent.OnServerEvent:Connect(function(Key)
KeyVar = Key
end)
game:GetService("RunService").Heartbeat:Connect(function()
print(KeyVar.." | KeyVar")
end)