<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.starfall.wtf/index.php?action=history&amp;feed=atom&amp;title=Money%2FShop_Scripts</id>
	<title>Money/Shop Scripts - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.starfall.wtf/index.php?action=history&amp;feed=atom&amp;title=Money%2FShop_Scripts"/>
	<link rel="alternate" type="text/html" href="https://wiki.starfall.wtf/index.php?title=Money/Shop_Scripts&amp;action=history"/>
	<updated>2026-07-28T18:04:38Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.starfall.wtf/index.php?title=Money/Shop_Scripts&amp;diff=459&amp;oldid=prev</id>
		<title>PRG: Created page with &quot;{{CatUp|Tutorials}} __TOC__  == Introduction ==  This is an easy way to get started with shop scripts.  This will go over everything you need to know to get a money system working.  Before you start this I suggest reading Basic Scripting.  == Basic script ==  Below is a basic leaderboard script.  For now, I&#039;m going to access everything using the name &quot;Cash&quot;, so if you change the name of your money (cash.Name = &quot;Cash&quot;) in the leaderboard to something like &quot;Credits&quot;, r...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.starfall.wtf/index.php?title=Money/Shop_Scripts&amp;diff=459&amp;oldid=prev"/>
		<updated>2024-12-10T21:54:56Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{CatUp|Tutorials}} __TOC__  == Introduction ==  This is an easy way to get started with shop scripts.  This will go over everything you need to know to get a money system working.  Before you start this I suggest reading &lt;a href=&quot;/index.php/Basic_Scripting&quot; title=&quot;Basic Scripting&quot;&gt;Basic Scripting&lt;/a&gt;.  == Basic script ==  Below is a basic leaderboard script.  For now, I&amp;#039;m going to access everything using the name &amp;quot;Cash&amp;quot;, so if you change the name of your money (cash.Name = &amp;quot;Cash&amp;quot;) in the leaderboard to something like &amp;quot;Credits&amp;quot;, r...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{CatUp|Tutorials}}&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This is an easy way to get started with shop scripts.  This will go over everything you need to know to get a money system working.  Before you start this I suggest reading [[Basic Scripting]].&lt;br /&gt;
&lt;br /&gt;
== Basic script ==&lt;br /&gt;
&lt;br /&gt;
Below is a basic leaderboard script.  For now, I&amp;#039;m going to access everything using the name &amp;quot;Cash&amp;quot;, so if you change the name of your money (cash.Name = &amp;quot;Cash&amp;quot;) in the leaderboard to something like &amp;quot;Credits&amp;quot;, remember to change the script(s) to reflect this change.&lt;br /&gt;
&lt;br /&gt;
Another important change you will have to make here is to make sure your Cash leaderboard starts your character off with some money (For example, cash.Value = 10000000).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
print(&amp;quot;Cash Leaderboard Loaded&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function onPlayerEntered(newPlayer)&lt;br /&gt;
&lt;br /&gt;
	local stats = Instance.new(&amp;quot;IntValue&amp;quot;)&lt;br /&gt;
	stats.Name = &amp;quot;leaderstats&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	local cash = Instance.new(&amp;quot;IntValue&amp;quot;)&lt;br /&gt;
	cash.Name = &amp;quot;Cash&amp;quot;&lt;br /&gt;
	cash.Value = 1000&lt;br /&gt;
&lt;br /&gt;
	cash.Parent = stats&lt;br /&gt;
	stats.Parent = newPlayer&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
game.Players.ChildAdded:connect(onPlayerEntered)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Basic onTouch Money Checker ==&lt;br /&gt;
This will be used for pretty much anything that you only want to happen to people if they have enough cash. So, the basic frame work of everything onTouch will start us off.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function onTouched(hit)&lt;br /&gt;
end&lt;br /&gt;
script.Parent.Touched:connect(onTouched)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, lets add an &amp;#039;if&amp;#039; line to make sure its a human!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;if hit.Parent.Humanoid~= nil then&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With every &amp;#039;if&amp;#039; line you need another end, so we will count those up a little later.  Now, we need to define where the money is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cash= game.Players:playerFromCharacter(hit.Parent).leaderstats.Cash&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We only want this to work if the player has enough cash:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;if cash.Value&amp;gt;= 100 then &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then to take away the money!  Notice, we will need to have a starting value of some money in order to make this script work:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; cash.Value= cash.Value - 100&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Lets look at what we have so far:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; function onTouched(hit)&lt;br /&gt;
 if hit.Parent.Humanoid~= nil then&lt;br /&gt;
  cash = game.Players:findFirstChild(hit.Parent.Name).leaderstats.Cash -- Find out who touched.&lt;br /&gt;
  if cash.Value &amp;gt;= 100 then&lt;br /&gt;
   cash.Value = cash.Value- 100&lt;br /&gt;
   --What you want to happen goes here.&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
script.Parent.Touched:connect(onTouched)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What does that do?  It will check and make sure what is hitting it is a human.  Then, it will check to make sure it has enough cash.  Finally, it will take away that cash.  You can pretty much choose what you want to happen after that, imagination is key!&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting Tutorials]]&lt;/div&gt;</summary>
		<author><name>PRG</name></author>
	</entry>
</feed>