Local scripts don't run when they are a child of a part. They also won't run when there's a touch event(in this situation). It's much easier to use a script. The Character property contains a reference to a Model containing a Humanoid, body parts, scripts, and other objects required for simulating the player’s avatar in-game. The model is parented to the Workspace, but may be moved. Here is a sample code:
local PlayersService = game:GetService('Players')
local function Ontouch(part)
if part.Parent:FindFirstChild("Humanoid") then
local playerModelName = part.Parent.Name -- gets the name of the player model
local player = PlayersService:FindFirstChild(playerModelName)
player.Character = workspace.Dummy -- write the path to the character you want
end
end
script.Parent.Touched:Connect(Ontouch)
Make this a Script(not a local one) and make it the child of the part you want to touch and get the character.
For the camera to follow the newly assigned character, you need to write a script to do that.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…