Hi, I am making a tycoon and I already created functions to assign a tycoon to a player, but this is my first game and I'm not sure what to do here:
local Players = game:GetService("Players")
local ServerScriptService = game:GetService("ServerScriptService")
local TycoonController = require(ServerScriptService:WaitForChild("TycoonController"))
local DroppingController = require(ServerScriptService:WaitForChild("DroppingController"))
local function setCollision(character)
local characterParts = character:GetChildren()
for _, part in ipairs(characterParts) do
if part:IsA("BasePart") then
part.CollisionGroup = "Players"
end
end
end
local function assignTycoon(player)
local tycoon = TycoonController.claimTycoon(player)
local drop = DroppingController.dropPart(tycoon)
player.CharacterAdded:Connect(setCollision)
end
Players.PlayerAdded:Connect(assignTycoon)
So I have my PlayerAdded connected to assignTycoon, but I realized that I also need to add my leaderstats script on player join, so do I create a brand new PlayerAdded connection, or do I instead just create a new onPlayerJoin function and call assignTycoon and pass the player to it right after the function is called if that makes sense? Sorry if it's hard to understand, I'm quite new.