Hello, I am making a script that will make you collect coins. In the script, I thought using “givegold(object)” would help but I don’t know what (object) means. Yes, I am doing this in a module script because I don’t know how to implement this into my regular script. Any help appreciated.
local FunctionModule = {}
function FunctionModule.givegold(object)
local humanoid = object.Parent:FindFirstChild("Humanoid")
if humanoid ~= nil then
local player = game.Players:FindFirstChild(humanoid.Parent.Name)
if player ~= nil then
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats ~= nil then
local gold = leaderstats:FindFirstChild("gold")
if gold ~= nil then
gold.Value = gold.Value + 1
end
end
end
script.Parent.Coin.Ccoin:Remove()
workspace.Coin.uni004D:Remove()
end
end
return FunctionModule