Hello, I am making a simulator type game. This game involves being able to buy "Donuts" from the store using the players leaderboard points.
The problem.
After pressing the button what takes away the players points and gives them a "Donut" the tool does not work. The Donut/Tool is eatable what adds points to the players leaderboard value. However the player gets the Donut/Tool into their inventory but the tool no longer works. It cannot be eaten nor add points, it simply does nothing when clicked.
This is weird as if the donut is in the players inventory without being cloned it works perfectly
This is in a local script inside of the button the player presses to take away their points and give them the Tool/Donut.
I made sure it would check that the players points are greater than 30 to run the code. This worked perfectly fine and cloned the tool.
The code is below.
local players = script.Parent.Parent.Parent.Parent
local player = game.Players.LocalPlayer
local upgradeStuff = game.Workspace.Folder:FindFirstChild("RareDonut")
script.Parent.MouseButton1Click:Connect(function()
if players.leaderstats.DonutStrength.Value > 30 then
players.leaderstats.DonutStrength.Value = players.leaderstats.DonutStrength.Value - 30
local clone = upgradeStuff:Clone()
clone.Parent = player.Backpack
script.Parent.Parent.correct:Play()
else
print("Not enough points!")
script.Parent.Parent.Error:Play()
end
end)
Thank you in advance.
