#How to change players model when he touches something?

11 messages · Page 1 of 1 (latest)

haughty pythonBOT
#

studio** You are now Level 1! **studio

solemn crest
#

local modelToSwapIn = game:GetService("InsertService"):LoadAsset(123456):GetChildren()[1] -- Replace 123456 with the Asset ID of the model you want to swap in

function onTouched(part)
local humanoid = part.Parent:FindFirstChild("Humanoid")
if humanoid then
local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
if player then
local character = player.Character
if character then
-- Remove the old character model
character:Destroy()

            -- Clone the new model and attach it to the player's character
            local newCharacter = modelToSwapIn:Clone()
            newCharacter.Parent = workspace
            player.Character = newCharacter
        end
    end
end

end

script.Parent.Touched:Connect(onTouched)

#

@odd kiln

odd kiln
#

tysm

odd kiln
#

uhhh

#

i got an error

#

maybe I did something wrong

#

@solemn crest

odd kiln
#

actaully

#

I fixed that but now the character dissapears