Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I can't seem to get my selling function to work. What am I doing wrong?

Asked by 1 year ago

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)    
0
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? Jay123abc2 241 — 1y

Answer this question