#New to scripting, making a tycoon for practice

1 messages · Page 1 of 1 (latest)

sweet pollen
#

So, I need help with my script. Im not getting any errors, and print("Hit registered") is working just fine. Im just getting no results with the rest.

`local PurchasedItem = "Wall1" -- set this to what you want to be purchased

local TycoonBuild = script.Parent.Parent.Parent.TycoonBuild
local ButtonsFold = script.Parent.Parent
local Button = script.Parent.Button
local Holder = Button.Parent.Holder
local upgradeReq = Button.Upgrade
local upgradeCost = Button.Cost
local tycoonOwner = TycoonBuild:WaitForChild("Owner")

Button.Touched:Connect(function(hit)

print("Hit registered") -- delete after testing, this is just a check

local humanoid = hit.Parent:FindFirstChild("Humanoid")
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local money = player:WaitForChild("leaderstats").Money
if hit.Parent == humanoid then
    if player.Name == tycoonOwner then             -- tycoonOwner is is a string value in a folder 
        if money.Value >= 100 then
            money.Value = money.Value - 100
            TycoonBuild.Wall1.Transparency = 0
            TycoonBuild.Wall1.CanCollide = true
            Button.CanTouch = false
            Button.CanCollide = false
            Button.Transparency = 1
            Holder.CanTouch = false
            Holder.CanCollide = false
            Holder.Transparency = 1
            
        else
            print(player .. "can't afford the upgrade")
        end
    end
end

end)`

sweet pollen
#

the problem is with local money = player:WaitForChild("leaderstats").Money

#

but idk where to go from there because leaderstats is a model with an intvalue named money inside of it

#

located inside of the player

simple hedge
#

Did you keep the casing correct?

sweet pollen
#

yeah the casing is correct

#

i did some checks and it stops when it gets to local money = player:WaitForChild("leaderstats").Money

novel patrol
sweet pollen
#

oh damn