import{_ as s,o as a,c as e,Q as n}from"./chunks/framework.419948d5.js";const F=JSON.parse('{"title":"Getting Started","description":"","frontmatter":{},"headers":[],"relativePath":"guide/getting-started.md","filePath":"guide/getting-started.md"}'),l={name:"guide/getting-started.md"},o=n(`<h1 id="getting-started" tabindex="-1">Getting Started <a class="header-anchor" href="#getting-started" aria-label="Permalink to &quot;Getting Started&quot;">​</a></h1><p>First, you have to require the module</p><div class="language-lua vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">lua</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#F97583;">local</span><span style="color:#E1E4E8;"> FastNet2 </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">require</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&#39;path.to.module&#39;</span><span style="color:#E1E4E8;">);</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#D73A49;">local</span><span style="color:#24292E;"> FastNet2 </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">require</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&#39;path.to.module&#39;</span><span style="color:#24292E;">);</span></span></code></pre></div><p>Then, to create a new event you have to use <code>.new</code> function</p><div class="language-lua vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">lua</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#F97583;">local</span><span style="color:#E1E4E8;"> Remote </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> FastNet2.</span><span style="color:#79B8FF;">new</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;EventName&quot;</span><span style="color:#E1E4E8;">);</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#D73A49;">local</span><span style="color:#24292E;"> Remote </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> FastNet2.</span><span style="color:#005CC5;">new</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;EventName&quot;</span><span style="color:#24292E;">);</span></span></code></pre></div><p>Firing event everytime player join</p><div class="language-lua vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">lua</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#F97583;">local</span><span style="color:#E1E4E8;"> Players </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">game</span><span style="color:#E1E4E8;">:</span><span style="color:#79B8FF;">GetService</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;Players&quot;</span><span style="color:#E1E4E8;">)</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">Players.</span><span style="color:#B392F0;">PlayerAdded</span><span style="color:#E1E4E8;">:</span><span style="color:#79B8FF;">Connect</span><span style="color:#E1E4E8;">(</span><span style="color:#F97583;">function</span><span style="color:#E1E4E8;">(player)</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#B392F0;">Remote</span><span style="color:#E1E4E8;">:</span><span style="color:#79B8FF;">Fire</span><span style="color:#E1E4E8;">(player, </span><span style="color:#9ECBFF;">&quot;Welcome!&quot;</span><span style="color:#E1E4E8;">)</span></span>
<span class="line"><span style="color:#F97583;">end</span><span style="color:#E1E4E8;">)</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#D73A49;">local</span><span style="color:#24292E;"> Players </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">game</span><span style="color:#24292E;">:</span><span style="color:#005CC5;">GetService</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;Players&quot;</span><span style="color:#24292E;">)</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">Players.</span><span style="color:#6F42C1;">PlayerAdded</span><span style="color:#24292E;">:</span><span style="color:#005CC5;">Connect</span><span style="color:#24292E;">(</span><span style="color:#D73A49;">function</span><span style="color:#24292E;">(player)</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#6F42C1;">Remote</span><span style="color:#24292E;">:</span><span style="color:#005CC5;">Fire</span><span style="color:#24292E;">(player, </span><span style="color:#032F62;">&quot;Welcome!&quot;</span><span style="color:#24292E;">)</span></span>
<span class="line"><span style="color:#D73A49;">end</span><span style="color:#24292E;">)</span></span></code></pre></div><p>FastNet2 have built-in feature called <code>pre-process</code> that could wait until the player event is being connected, so you dont have worry about that!</p>`,8),p=[o];function t(c,r,y,i,E,d){return a(),e("div",null,p)}const g=s(l,[["render",t]]);export{F as __pageData,g as default};
