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

Clone a tool using values?

Asked by 3 years ago

Hello! I am new to scripting and i tried scripting using two other scripts and i tried to make a script and it doesnt work, i dont really know whats right or wrong so it would be helpful if anyone could help me.

local ToolNames = {"SPECTRE M4"}
local Storage = game:GetService("ServerStorage")


script.Parent.MouseButton1Click:Connect(function(Player)
    if  leaderstats.Money.Value = Money > 0 then
        local Backpack = Player:WaitForChild("Backpack")
        for i = 1 #ToolNames do
            local tool = Storage:FindFirstChild(ToolNames[i])
            if tool then
                Tool:clone().Parent = Backpack
            end
        end
    end
end)

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

In Line 06 You Made An Error; Instead Of Putting;

 if  leaderstats.Money.Value = Money > 0 then

Put;

if  leaderstats.Money.Value > 0 then
0
do i have to do this in localscript or regular script? nooby14327 2 — 3y
0
local 25MouseSensitivity 63 — 3y
0
Sorry I Mean ServerScript/Regular Script 25MouseSensitivity 63 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

You can't get player from MouseButton1Click. You need to use events.

Answer this question