In my game, battles are organized periodically between two players. At the start of each one, the two players are supposed to be placed a few dozen studs away, facing one another. I don't want the players to be able to walk around during this point, so I decided it'd be best to keep them still until the battle actually starts. To do this, I tried disabling the ControlScript, which is a script inside of all Players that controls their ability to move via input from the keyboard and mouse. However, when I did this, the game told me that PlayerScripts is not a valid member of player. But when I test this in Studio, I can clearly see that PlayerScripts IS in the player! So why is this happening? I'm genuinely confused.
This is my script. I don't wanna have to anchor the player's torso, as that would restrict the R15 idle animations, which I'd really like to keep. If the way I'm going about it isn't going to work, is there any way I can keep a player completely still and looking in the same direction while preserving the R15 animations?
function teleportToBattle(p1, p2) player1 = game.Players:FindFirstChild(p1.Name) --Finding the players. player2 = game.Players:FindFirstChild(p2.Name) if player1 and player2 then --If they are both present. player1.PlayerScripts.ControlScript.Disabled = true --The part that disables the player's ability to move. player1.Character.Torso.CFrame = CFrame.new(Vector3.new(-62, 8, -89.5)) --Teleports tthem to their respective position. player1.Character.HumanoidRootPart.Rotation = Vector3.new(0, -90, 0) --To make them face one another. player2.PlayerScripts.ControlScript.Disabled = true --This too. player2.Character.Torso.CFrame = CFrame.new(Vector3.new(-48, 8, -89.5)) player2.Character.HumanoidRootPart.Rotation = Vector3.new(0, 90, 0) elseif player1 and not player2 then --In case one leaves or lags out. print("player1 wins") elseif player2 and not player1 then print("player2 wins") else print("no one wins") end end
PlayerScript / PlayerGui (And maybe backpack) can not be accesed from the server IF you have FE on.
You should use the anchor idea you had, but on the Character.HumanoidRootPart. This is an invisible part the R6 and R15 both have.