Hello!
I’m working on crafting system, how is it supposed to work?
If I have tool “test”, after I click the button, it’s supposed to give me tool “test2”.
It doesn’t work.
Here’s the script:
local player = game:GetService(“Players”)
script.Parent.MouseButton1Click:Connect(function()
if player.Localplayer.Backpack[“test”] then
local tool = game.ServerStorage[“test2”]
local klone = tool:Clone()
klone = player.Localplayer.Backpack
end
end)
I changed script a little, but it still doesnt work
local player = game:GetService(“Players”)
script.Parent.MouseButton1Click:Connect(function()
if player.Localplayer.Backpack[“test”] == true then
local tool = game.ServerStorage[“test2”]
local klone = tool:Clone()
klone = player.Localplayer.Backpack
end
end)
local player = game:GetService(“Players”)
script.Parent.MouseButton1Click:Connect(function()
if game.Players.LocalPlayer.Backpack[“test”] == true then
local tool = game.ServerStorage[“test2”]
local klone = tool:Clone()
klone = game.Players.LocalPlayer.Backpack
end
end)
local players = game:GetService("Players")
script.Parent.MouseButton1Click:Connect(function()
if players.LocalPlayer.Backpack:FindFirstChild("Test") then
local tool = game.ReplicatedStorage:FindFirstChild("Test2"):Clone()
tool.Parent = players.LocalPlayer.Backpack
end
end)
Put the tool inside ReplicatedStorage and change your code to this.
local Players = game:GetService('Players')
local ReplicatedStorage = game:GetService('Players')
script.Parent.MouseButton1Click:Connect(function()
if Players.LocalPlayer.Backpack:FindFirstChild('test') then
local clone = ReplicatedStorage['test2']:Clone()
clone.Parent = Players.LocalPlayer.Backpack
end
end)
local player = game:GetService(“Players”)
script.Parent.MouseButton1Click:Connect(function()
if game.Players.LocalPlayer.Backpack[“test”] == true then
local tool = game.ReplicatedStorage[“test2”]
local klone = tool:Clone()
klone.Parent=game.Players.LocalPlayer.Backpack
end
end)