I'm trying to make a shop GUI for a little game I'm making, and it was working fine but then I realized it was just moving a tool to the player backpack rather than cloning it. After I tried to do that it broke and now it just says
"Attempt to connect failed: Passed value is not a function"
Then when I click it, it says
"attempt to call a nil value"
I just want to add that I'm quite new and don't know much about scripting
Script:
player = script.Parent.Parent.Parent.Parent.Parent.Parent
local scriptOn = false
local RS = game:GetService("ReplicatedStorage")
local item = game RS:WaitForChild("Milk")
if game.Players.LocalPlayer.leaderstats.Dollaroos.Value >= 15 then scriptOn = true else scriptOn = false
if scriptOn then
function Click(mouse)
local newMilk = item:Clone()
newMilk.Parent = player.Backpack
newMilk.Parent = player.StarterGear
game.Players.LocalPlayer.leaderstats.Dollaroos.Value = game.Players.LocalPlayer.leaderstats.Dollaroos.Value - 15
scriptOn = false
end
end
end
script.Parent.MouseButton1Down:connect(Click)
