So, I’m making an aot game and i’ve had a problem for a while.
When the titans spawn they’re sometimes invisible on client, and become visible when the player respawns, but are always visible on server, after trying to fix it for a bit i believe the reason they’re invisible is my Resize script, which i use to give the titans a random size:
local PhysicsService = game:GetService("PhysicsService")
game.ReplicatedStorage.GrowthEvent.Event:Connect(function(Titan)
local Percent = math.random(10,19) / 10 --
local Humanoid = Titan.Humanoid
--
local Motors = {}
table.insert(Motors, Titan.HumanoidRootPart.RootJoint)
for i,Motor in pairs(Titan:GetDescendants()) do
if Motor:IsA("Motor6D") then
table.insert(Motors, Motor)
end
end
--
for i,v in pairs(Motors) do
v.C0 = CFrame.new((v.C0.Position * Percent)) * (v.C0 - v.C0.Position)
v.C1 = CFrame.new((v.C1.Position * Percent)) * (v.C1 - v.C1.Position)
end
--
--
for i,Part in pairs(Titan:GetDescendants()) do
if Part:IsA("BasePart") then
Part.Size = Part.Size * Percent
PhysicsService:SetPartCollisionGroup(Part,"T")
local ok, groupId = pcall(PhysicsService.GetCollisionGroupId, PhysicsService, "T")
end
end
---
---
for i,Accessory in pairs(Titan:GetChildren()) do
if Accessory:IsA("Accessory") then
Accessory.Handle.AccessoryWeld.C0 = CFrame.new((Accessory.Handle.AccessoryWeld.C0.Position * Percent)) * (Accessory.Handle.AccessoryWeld.C0 - Accessory.Handle.AccessoryWeld.C0.Position)
Accessory.Handle.AccessoryWeld.C1 = CFrame.new((Accessory.Handle.AccessoryWeld.C1.Position * Percent)) * (Accessory.Handle.AccessoryWeld.C1 - Accessory.Handle.AccessoryWeld.C1.Position)
Accessory.Handle.Mesh.Scale *= Percent
end
end
end)
any tips to improve the script and maybe fix the problem? any help be appreciated.
it is also worth mentioning that on client the titan’s size changes and their transparency property is at 0.