Generated by Rojo 7.5.1.
To use EasyCharacter, head to Releases and download the latest version of the rbxm.
With EasyCharacter
--server script
local Players = game:GetService("Players")
local EasyCharacter = require(path.to.EasyCharacter)
Players.PlayerAdded:Connect(EasyCharacter)
--local script
local EasyCharacter = require(ReplicatedStorage.Shared.EasyCharacter)
EasyCharacter(Player, function()
print("Character added for local player:", Player.Name)
-- You can add more logic here to handle the character
end)
Without EasyCharacter
--server script
local Players = game:GetService("Players")
local function onCharacterAdded(char : Model)
print("this is getting pretty messy already")
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(onCharacterAdded)
--init at the bottom incase server didnt get that line above
if player.Character then
onCharacterAdded(player.Character)
end
end)
--local script
local Player = game.Players.LocalPlayer
local function onCharacterAdded(character : Model)
print("this is stuff happens when the character is added")
end
Player.CharacterAdded:Connect(onCharacterAdded)
if Player.Character then
onCharacterAdded(Player.Character)
end
Before you criticize on why this module looks useless, I made this for some personal projects. I decided to make this open-source because there was no reason not to.