So I'm making a tree cutting game, in which you cut down trees which gives wood. Now I'm currently trying to make a selling area with a Touched function, but it doesn't seem to work.
script.Parent.Touched:connect(function(part)
local plr = game.Players:GetPlayerFromCharacter(part.Parent)
local cash = plr.leaderstats.Cash
local gui = plr.PlayerGui.inventory
local woodvalue = plr.PlayerGui.inventory.frame.wood.value
if woodvalue.Value ~= 0 then
cash.Value = cash.Value + woodvalue.Value
woodvalue.Value = 0
end
end)

1 comment
I cant see but, it could be any of the following; plr might not be correctly getting found, allong with any other local. Does the woodvalue get changed by a LOCAL script, and is this a server script? [As local script willl change values locally, server scripts cant see that.]? Is it giving a error?