01 | local player = game.Players.LocalPlayer |
02 | local currency = player:WaitForChild( 'leaderstats' ).Coins |
03 | local amount = 200 |
04 | local tool = game.ServerStorage:WaitForChild( 'LinkedSword' ) |
05 | local indextext = script.Parent.Text |
06 | script.Parent.MouseButton 1 Click:connect( function () |
07 | if currency.Value > = amount and not player.Backpack:FindFirstChild( 'LinkedSword' ) or player.Character:FindFirstChild( 'LinkedSword' ) then |
08 | currency.Value = currency.Value - amount |
09 | local newtool = tool:Clone() |
10 | newtool.Parent = player.Backpack |
11 | script.Parent.TextColor 3 = Color 3. fromRGB( 11 , 199 , 4 ) |
12 | script.Parent.Text = 'Purchase succesful!' |
13 | wait( 2 ) |
14 | script.Parent.TextColor 3 = Color 3. fromRGB( 27 , 42 , 53 ) |
15 | script.Parent.Text = indextext |
I don't get why it doesn't work in an actual server. Anyone know why?
I'm guessing this is a local script? Just a guess, but use Lighting or ReplicatedStorage instead of ServerStorage for your sword. Also, IS it "Clone" or "clone" -- I'm really sleepy right now so I'm not very sure