I need help with this error because i cant find any solutions
The tycoon module
function Tycoon.ClaimTycoon(player, tycoon)
local starterBuild = tycoon.StarterBuild
if tycoon:GetAttribute("Owner") ~= "NoOne" then return end
tycoon:SetAttribute("Owner", player.Name)
local claimedTycoon = Instance.new("StringValue")
claimedTycoon.Name = "ClaimedTycoon"
claimedTycoon.Parent = player
Tycoon.LoadTycoon(player, tycoon)
local profile = Manager.Profiles[player]
local collectionPad = tycoon.StarterBuild.CollectingPad
while task.wait(1) do
Manager.adjustTycoonCurrency(player, profile.Data.TycoonData.TycoonCurrency)
end
collectionPad.PrimaryPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local playerTouch = Players:GetPlayerFromCharacter(hit.Parent)
if playerTouch.Name == player.Name then
if collectDebounce[player] then return end
collectDebounce[player] = true
profile.Data.leaderstats.Cash += profile.Data.TycoonData.TycoonCurrency
profile.Data.TycoonData.TycoonCurrency = 0
task.wait(2)
if collectDebounce[player] then
collectDebounce[player] = false
end
end
end
end)
RunService.Heartbeat:Connect(function()
collectionPad.BillboardGui.TextLabel.Text = player.Name.." 's tycoon \ncash to collect: \n"..FormatNumberAlt.FormatStandard(profile.Data.TycoonData.TycoonCurrency)
end)
end
i thought it was the template but it looks fine to me
local Manager = {}
Manager.Profiles = {}
function Manager.adjustTycoonCurrency(player: Player, amount: number)
local profile = Manager.Profiles[player]
if not profile then return end
profile.Data.TycoonData.TycoonCurrency += amount
print(profile.Data.TycoonData.TycoonCurrency)
end
return Manager
Try checking within the module and make sure you know what it is receiving:
function Manager.adjustTycoonCurrency(player: Player, amount: number)
print("player: Player, amount: number =", player, amount)
local profile = Manager.Profiles[player]
if not profile then return end
profile.Data.TycoonData.TycoonCurrency += amount
print(profile.Data.TycoonData.TycoonCurrency)
end