So I’m currently working on a game with a realistic work system. I’ve made a Regiestar that goes along with a selling station. How the script is supposed to work, is that, when the station has been set up, it will take the player’s username and put it on textlabel within a billboardgui. When a player comes up to the registar, equips a wallet, and then activiates a prompt within the Registar (The Script is a parent of the prompt) it will get the name of the player via the textlabel gui, and if the name is vaild it will continue. it will get a number from a NumberValue that has been set to a certain amount. The reason why I added a numbervalue is that I want to later implement the crap where u set sale numbers. Blah blah blah.
After stealing the number, it then gives that amount to the player. Basically a player goes up to the other players selling station, and activiates the proximity prompt, and then it will get the username in the textlabel, then get the sale value via numbervalue, and then give that amount to the player. Though, I’ve run into problems with scripting this crap.
Apparently when the events happen, the script refuses to run the “Cash.Value += saleValue.Value” Part. Thus getting nothing. I’ve tried several solutions, though nothing has really worked.
I’ve published my game, leaderstats are set up for my game, I’ve tried many things, nothing much has worked. It’s weird as heck why it just won’t run this section.
Could you give me some advice or help?
It also refuses to give me errors or anything alluding to that my script is broken.
local prompt = script.Parent
local saleValue = prompt:FindFirstChild("SaleValue")
prompt.Triggered:Connect(function(player)
-- this checks if Wallet" is equipped
local character = player.Character
if not character then return end
local walletEquipped = false
for _, tool in ipairs(character:GetChildren()) do
if tool:IsA("Tool") and tool.Name == "Wallet" then
walletEquipped = true
break
end
end
if not walletEquipped then return end
---gets the player's name via the sh!tty textkabelhguioeqw
local billboardGui = script.Parent.Parent.Parent.Parent.Parent.PlrName:FindFirstChild("BillboardGui")
if not billboardGui then return end
local textLabel = billboardGui:FindFirstChildWhichIsA("TextLabel")
if not textLabel then return end
local targetUsername = textLabel.Text
if not targetUsername or targetUsername == "" then return end
-- this Finds target player by name
local targetPlayer = game.Players:FindFirstChild(targetUsername)
if not targetPlayer then return end
-- Makes sure SaleValue exists and is a valid number
if not saleValue or not saleValue:IsA("NumberValue") then return end
-- Add SaleValue to target player's leaderstats "Cash"
local leaderstats = targetPlayer:FindFirstChild("leaderstats")
if not leaderstats then return end
local Cash = leaderstats:FindFirstChild("Cash") -----||
if not Cash or not Cash:IsA("NumberValue") then return end ---||
----below this is the part of the script that refuses to Focking work and doesn't give me any errors or nothing. it's just the shit below this text here wont work...\/
print("Target:", targetPlayer)
print("Leaderstats:", leaderstats)
print("Cash:", Cash)
print("SaleValue:", saleValue.Value)
if Cash then
Cash.Value += saleValue.Value
-- cashStat.Value += 500
script.Parent.Parent.PurchaseEffect.Enabled = true
print("MoneySold!")
end
end)
Hopefully this can get fixed, because I generally have no idea why it won’t work, other than my scripting is either non-existant or I’m extremely bad at scripting.


