Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

When I Click My Money Goes Away But I Don't Get The Item?

Asked by 6 years ago

So Far I Have Made A Script And All I Need Is For It To Give Me The Item :/:

local debounce = false
function getPlayer(humanoid) 
local players = game.Players:children()
local user = game.Players.LocalPlayer
local player = game.Players.LocalPlayer
for i = 1, #players do 
if players[i].Character.Humanoid == humanoid then return players[i] end 
end 
return nil 
end 

script.Parent.MouseButton1Click:connect(function()

local gold = game.Players.LocalPlayer.leaderstats.Cash -- Replace MONEY with the name of currency name your leaderboard uses

if gold.Value >= 100 then -- Replace 100 with your price    

    gold.Value = gold.Value - 100 -- Replace 100 with your price

    local m = Instance.new("Message")

    m.Text = "You just bought a Laser Gun!" -- Replace TOOL with your weapon


    m.Parent = game.Players.LocalPlayer.PlayerGui
    wait(3)
    m:Destroy()

wait(1)
local Gear1 = script.Parent.LaserGun
Gear1:Clone() 
Gear1:Clone()
Gear1:Clone()
Gear1:Clone()
Gear1:Clone()
Gear1:Clone() 
Gear1:Clone()
Gear1:Clone()
Gear1:Clone()
Gear1:Clone()
Gear1:Clone() 
Gear1:Clone()
Gear1:Clone()
Gear1:Clone()
Gear1:Clone()
Gear1.Parent = game.Players.LocalPlayer

    wait(2)

    m.Parent = nil

else

    m = Instance.new("Message")

    m.Text = "You don't have enough for that!"
    m:Destroy()

    m.Parent = game.Players.LocalPlayer.PlayerGui

    wait(3)

    m.Parent = nil

end



wait(2)

debounce = false

end)











Please Help

0
Is This A Local Script? If so, what is it under? SooGloezNoob 45 — 6y

2 answers

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

Put the laser gun that you want to clone inside of ReplicatedStorage.

So when you go to clone it do

local player = game.Players.LocalPlayer

local laserGun = game.ReplicatedStorage.NameOfYourGunGoesHere -- insert name of your tool
laserGun.Parent = player.Backpack

this only works if it is a local script btw

0
Thank You JamiethegreatQ777 16 — 6y
0
no problem! PoePoeCannon 519 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Gear1:Clone()
Gear1.Parent = game.StarterPack

When you say "game.Players.LocalPlayer" you're not putting it in your inventory/backpack.

Answer this question