继承自:
Avatar部件节点
local player = script.Parent.Parent
local playerBody = player.Character
local function changeAvatar()
local function printSystemAvatarID(avatarName)
local actorAvatarNode = playerBody.AvatarPartGroup[avatarName]
print(actorAvatarNode.ModelId)
end
local function changeAvatar(avatarName, asset1, asset2, asset3)
if not asset1 then
asset1 = ""
end
if not asset2 then
asset2 = ""
end
if not asset3 then
asset3 = ""
end
local actorAvatarNode = playerBody.AvatarPartGroup[avatarName]
actorAvatarNode.ModelResId = asset1
actorAvatarNode.DiffuseTexResId = asset2
actorAvatarNode.EmissiveTexResId= asset3
actorAvatarNode.Show = true
end
local function attachCustomAvatar()
changeAvatar("BODY", "SandboxId&restype=21://entity/player/player12/2.omod")
changeAvatar("HEAD", "SandboxId&restype=21://entity/player/player12/2.omod")
changeAvatar("JACKET", "SandboxId&restype=21://entity/player/player12/2.omod")
end
local function detachCustomAvatar()
changeAvatar("BODY", "")
changeAvatar("HEAD", "")
changeAvatar("JACKET", "")
end
printSystemAvatarID("BODY")
printSystemAvatarID("HEAD")
printSystemAvatarID("JACKET")
Wait(3)
print("attach custom Avatar")
attachCustomAvatar()
Wait(3)
print("detach custom Avatar")
detachCustomAvatar()
Wait(3)
end
local function changeSkin()
local function takeInSkin()
playerBody.SkinId = 10
end
local function takeOffSkin()
playerBody.SkinId = 0
playerBody.ModelId = "sandboxSysId://entity/player/player12/body.prefab"
end
print(playerBody.SkinId)
print(playerBody.ModelId)
Wait(3)
print("take in skin")
takeInSkin()
Wait(3)
print("take off skin")
takeOffSkin()
Wait(3)
end
Wait(3)
changeAvatar()
changeSkin()