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)`