sm64-roblox-liberty-prime/server/StarterCharacter/init.server.lua
Max ba0e5364bb Major restructuring and bug fixes.
Moved a lot of things around, fixed a lot of bugs, made the animations and sounds public. Special thanks to CuckyDev for helping me track down all the small problems that were lingering, and for fixing a major issue with the simulation rate. There's still some stuff to fix and improve, but now this should be more portable and useable by the wider community! 🎉

Co-Authored-By: Regan Green <cuckydev@gmail.com>
2023-07-07 22:01:02 -05:00

65 lines
1.5 KiB
Lua

--!strict
local Players = game:GetService("Players")
local StarterPlayer = game:GetService("StarterPlayer")
local PhysicsService = game:GetService("PhysicsService")
local StarterCharacterScripts = StarterPlayer.StarterCharacterScripts
local hDesc = Instance.new("HumanoidDescription")
hDesc.HeightScale = 1.3
hDesc.WidthScale = 1.3
hDesc.DepthScale = 1.4
hDesc.HeadScale = 2
local character = Players:CreateHumanoidModelFromDescription(hDesc, Enum.HumanoidRigType.R15)
local bodyColors = character:FindFirstChildOfClass("BodyColors")
local animate = character:FindFirstChild("Animate")
local oldRoot = character.PrimaryPart
if animate then
animate:Destroy()
end
if oldRoot then
oldRoot:Destroy()
end
if bodyColors then
bodyColors:Destroy()
end
local newRoot = script.HumanoidRootPart
newRoot.Parent = character :: any
local humanoid = assert(character:FindFirstChildOfClass("Humanoid"))
humanoid:BuildRigFromAttachments()
local dummyScripts = {
"Animate",
"Health",
"Sound",
}
for _, dummy in dummyScripts do
local stub = Instance.new("Hole", StarterCharacterScripts)
stub.Name = dummy
end
for _, child in script:GetChildren() do
child.Parent = StarterCharacterScripts
if child:IsA("Script") then
child.Disabled = false
end
end
character.Name = "StarterCharacter"
character.PrimaryPart = newRoot
character.Parent = StarterPlayer
PhysicsService:RegisterCollisionGroup("Player")
PhysicsService:CollisionGroupSetCollidable("Default", "Player", false)
for _, player in Players:GetPlayers() do
task.spawn(player.LoadCharacter, player)
end