The default CameraScript and ControlScript work on the Player’s character. You could try setting the possessed player’s Character to nil, and set the possessor’s Character to the victim character. It might just work?
That sounds like it would work ill give it a try, thanks!
Making the possessed players character nil broke the possession, and it automatically respawned my character. What other ways are there to make it so the other players character can not control themselves while they’re possessed?
You might be able to use HumanoidDescription to set the possessor’s character to be the possessed character and then make the camera of the possessed be the possessor’s camera.
I don’t see how I’d be able to do that, do you think you could elaborate with me? Isn’t HumanoidDescription used for changing character appearances?
It is yes but by setting the possessor’s character to the possessed and using some camera manipulation from the possessed and maybe teleporting the possessor to him would give the appearance of a possessed character (this doesn’t account for damage) I would suggest you to mess around with this and maybe you’ll stumble across a solution.
Idk tbh my only problem rn is making sure the possessed player can’t control themselves.
Oh sorry I misunderstood, couldn’t you just anchor their HumanoidRootPart?
If I did that though then the player possessing them wouldn’t really be possessing them. They’d just be frozen.
Also if I were to clone the player and tp them onto the possessed character, it wouldn’t effect the actual players stats (in my game) if their clone was to die. That’s why I think it would be better if the character itself was controlled, and the possessed character can not control themselves.
I mean, you could just account for the clone passing on the stats to the player on the server, it shouldn’t be that hard. But something I want to add on to what other people here have mentioned:
You could instead change the appearance of the player to be that of the possessed player, and teleport them to their location, while moving the possessed player’s character elsewhere where it won’t be affected. All you have to do is change the possessed player’s camera to the clone, thinking that is their character when really they’re watching the other player. A clone isn’t really necessary unless you want to avoid using the character of the player in control.
I feel like using a clone would require a bit more synchronization since you are changing two players’ cameras. I’m not sure if this matters in your game but it is something to consider. Hope this helps.
If characters respawning is causing the issue, you can set Players.CharacterAutoLoads
to false and write custom respawning logic.
That is what I said, no clones needed. The stats is the only trouble for him here though.
I’ve done this before using welds. It doesn’t use any method that actually makes you BECOME the player’s character, but it essentially attaches each of their body parts to yours.
Here’s an example: https://gyazo.com/80883d9fb565fc5fb6c64d3f5a49ec19
^ This was done an NPC, but it works just as well (if not better) on real players.
Here are all the steps that I did to actually gain control of their body parts done on the server:
- Get a way of identifying which character to take over (for me it was my mouse target with a RemoteEvent from a localscript)
- Make all your body parts and accessory handles invisible
- Log the victim’s Torso CFrame so that you can teleport to it after their parts are welded to you. I just did this:
- Turn the target’s Humanoid.PlatformStand property to true so that they lose control of their character
- Make all YOUR (or person who’s GOING to control the victim) body parts ‘.RootPriority’ property set as 2 and make YOUR HumanoidRootPart ‘.RootPriority’ property set as 3. Something like this:
- Create a weld for each body part except for the HumanoidRootPart. The ‘Part0’ property of the weld should be your body part and the ‘Part1’ property should be your victim’s body part. Something like this:
You want them in YOUR character so that: they go away when you die, there can be multiple people transforming at once, they are easier to clear when you untransform
- Now that all their character’s parts are attached to us, we have to tp to their previous location which we already set in Step 3.
- You should have a variable called “Transformed” or something like that. After you’ve transformed you should set it to true so that we know that the next action is to untransform. (assuming you want the ability to untransform)
- Now that the transforming process is finished, here’s how I untransformed. First I removed the welds:
Since this script was in a tool, it’s easy for me to identify my own character and this makes it easy to remove any of my own welds without messing around with other player’s transformations.
- Now we set our body parts RootPriority properties back to these recommended values. I did a lot of testing and these values worked best.
- Remove our invisibility that we previously gave to ourselves in our body parts and accessory handles.
- Turn the Humanoid.PlatformStanding to false on the victim’s humanoid so that they gain control again.
- Turn the ‘Transformed’ value back to false so that the script knows we aren’t transformed and are ready to go again.
There it is! It’s a lot of steps but it gave me the best result out of MANY that i tried. Obviously I added more effects and stuff in my example gif, but that’s up to you to figure out and create. Hope it helps.
Pretty good method there. Shouldn’t you be using HumanoidRootPart
instead of Torso
for R15 character support though?
(For the teleport part)
Very true. Also I just realized that if he wants to do this with R15 he’s gonna have to make welds for each of the body parts. This example is pretty old and supports R6 well.
Easier way of doing that would be:
for _,Parts in pairs (Player.Character:GetDescendants()) do
if Parts:IsA("BasePart") then
local Weld = Instance.new("Weld")
Weld.Part0 = Parts
Weld.Part1 = Victim:FindFirstChild(Parts.Name)
Weld.Parent = Parts
end
end
It is rough as I’m on mobile, but that’s an easier way instead of writing each individual part.
local Controller = --Player
local Controlled = --Player
local Folder = Instance.new("Folder",Controller)
Folder.Name='Welds'
Controlled.Humanoid.PlatformStand=true
local Pos1 = Controller.HumanoidRootPart.CFrame
local Pos2 = Controlled.HumanoidRootPart.CFrame
wait(1)
Controller.HumanoidRootPart.CFrame = Controlled.HumanoidRootPart.CFrame
for _, v in pairs(Controller:GetDescendants()) do
if v:IsA("Decal") then v.Transparency = 1 end
if v:IsA("BasePart") then
v.Transparency = 1
local part2 = Controlled:FindFirstChild(v.Name)
local weld = Instance.new("Weld")
weld.Part0=v
weld.Part1=part2
weld.Parent=Folder
v.RootPriority = 2
Controller.HumanoidRootPart.RootPriority=3
end
end
wait(20)
Folder:Destroy()
for _, v in pairs(Controller:GetDescendants()) do
if v:IsA("Decal") then v.Transparency = 0 end
if v:IsA("BasePart") then
v.Transparency = 0
v.RootPriority = 0
Controller.HumanoidRootPart.RootPriority=1
Controller.HumanoidRootPart.Transparency = 1
end
end
Controlled.Humanoid.PlatformStand=false
Controller.HumanoidRootPart.CFrame = Pos1
Controlled.HumanoidRootPart.CFrame = Pos2
dang that sounds so complicated, simple solution set player character to the npc
game.Players.Player1.Character = game.Players.Player2.Character
i don’t really get why you need to weld, a little bit convoluted
Welding is more efficient because you’d need to call LoadCharacter on both characters after they’re finished. You might be able to place the old player’s character somewhere that it can’t be effected though but Idk I haven’t tested that. I’m just somewhat aware that once you switch your character the other one disappears from my knowledge.