Hello,
I am making an inventory system with values, when you press a button, it releases the resource to the ground as a model that spawns in the workspace, this contains a proximityprompt with a script inside.
local Model = script.Parent.Parent
local Proximity = Model.ProximityPrompt
Proximity.Triggered:Connect(function(plr)
local ValueL = plr.Values:FindFirstChild("Loaf")
ValueL.Value += 1
Model:Destroy()
end)
When I hit him to grab, he doubles the value I dropped.
If I drop a loaf, I now have 2 in my inventory.
From what I see, it saves the previous value and duplicates it, but this value would already be at 0, since I made it set to 0 with another script
All values are in the player, which are added as he enters the game through a script.
local Players = game:GetService("Players")
local Valores = game.ReplicatedStorage.Valores
Players.PlayerAdded:connect(function(Player)
Valores:Clone().Parent = Player
end)
Sorry for the inconvenience and if you can help me I would be very grateful.