New Player Scripts are coming (10.11.18), and how you can prepare

playerscripts

#21

So how exactly do I access GetMoveVector() in the new scripts? Can you list a code snippet please. Thank you.


#22

It’s a consequence of exporting some of these from Studio, just after a bug got introduced that exports scripts (Save as File…) with \r\r\n (CR CR LF) line endings. I didn’t catch it because my diff program ignored it. I have since corrected this, though depending on the timing of the release, these stretched out versions may be live for a week or so. Functionality is not affected.


#23

Many of these inconsistencies are simply being carried over from the currently-deployed player scripts. The complete reworking of the player scripts is being rolled out in stages, with each stage addressing particular issues while trying to maintain status quo with regard to function. This stage is about restructuring, while trying to touch the underlying code as little a possible, so that any issues which arise are clearly the result of the structural changes and not hundreds of tiny differences introduced by code cleanup. I agree the cleanup is needed, I just want to isolate it from the restructure.

Just to be clear, you should not be forking or putting this pre-release code in your actual live game, it should be used only to evaluate whether or not having the player scripts restructured in this way affects your game. Things like commented out code, debug prints, etc. I’ve already removed from the build that will follow up a week later (a cleanup pass).

Additionally, this refactor is not about “allowing forking”, the whole point of the restructure is to minimize the need for developers to fork the scripts and forgo updates by letting them require the player scripts modules and call methods on them. Forking will still not be encouraged, apart from the special case of forking the old version while you adapt a game to the new structure.


#24

Is this the correct way to get the move vector in the new scripts?

-- In a local script
local PlayerModule = require(game.StarterPlayer.StarterPlayerScripts:WaitForChild("PlayerModule"))

local ControlModule = PlayerModule:GetControls()
if ControlModule then
    local MoveVector = ControlModule:GetMoveVector()
end

#25

There seems to be a change compared to the old player scripts in terms of GetMoveVector’s behavior. When you are just spawning, there is no control module set yet, so the returned control vector is nil. I would recommend returning a default value here (i.e. Vector3.new()) to minimize compatibility issues. @AllYourBlox

@MapleMarvel as such that is not enough, you’ll have to add “or Vector3.new()” behind the call for now, otherwise it might be nil.


#26

@buildthomas @AllYourBlox So is it the ControlModule that can be nil, or is it the GetMoveVector() call that can return nil? And is this every time the character spawns, or just when the player initially joins?


#27

It’s the vector. I haven’t seen the PlayerModule code, but you can check yourself if the module can return nil.

On another note, you want to use the PlayerModule given to the local player, not the one under StarterPlayer. I believe it appears under an object called PlayerScripts in each player.


#28

Spacing code out is quite common and an industry standard, although this is a little far lol.


#29

Sigh… so my game is going to break (again) on the 11th because I override MasterControl but no info on how to fix it ahead of time.


#30

What do you mean no info? (Did you read first post fully?) You should just fork the control script until this update goes through, and then update your codebase to work with the new structure whenever you get around to it.


#31

Just a reminder, this is happening today, in case you need to update your game with the legacy scripts.


#32

When will this be live?


#33

It is live now. It’s a server flag, so existing game servers will not be running the new scripts, only new servers that come online.


#34

Looks like requiring the new PlayerModule to use handy functions like :GetMoveVector() creates additional TouchGuis, doubling UI like the jump buttons on phone/tablet and causing weird glitches with the visuals and inputs.


When I comment out the code requiring PlayerModule, it returns to the correct behavior (only one TouchGui).

Here’s a repro.
NewPlayerScriptsTouchGuiCloneBug.rbxl (16.9 KB)

Also, it seems like the camera gets caught on the character when you look from below now.


#36

I have discovered a serious bug in the new camera scripts. I have filed a bug report, and included a repo file.


#37

While adjusting to the new system was not difficult, I can’t STAND the updates to the camera, as they are causing a ton of different issues in game with even basic functions. For example, this used to just watch the player from a given CFrame, but now it does this:

[Seizure Warning?]

I’m working on adapting to this but for now this is highly annoying to fight through. If I am being dumb and there’s a change I need to make that I’m forgetting feel free to call me out on it.


#38

We’ve turned off the new Player Scripts deployment to address the issue with the VehicleController no longer functioning. If you’re already actively working on migrating to the new structure, please be aware that right now these scripts are not deployed and any places with the pre-release scripts (or forked versions of what was live this morning) in them will additionally need a disabled or empty ControlScript or CameraScript in StarterPlayerScripts in order to suppress the automatic addition of the old player scripts in a published place.


#39

Is there any chance you have more than one script trying to control the camera in this place? It’s not immediately obvious to me what else would cause such erratic behavior.


#40

I’m in the process of checking for conflicts. The only thing that comes to mind is if interrupting an interpolation of the camera with another action no longer breaks / overrides it but instead acts in addition to the interpolation, then that might be causing the issue.


#41

I have had this problem too
I have one script that sets the camera to “Scriptable”, sets the CFrame of the camera, then uses tweenservice to tween the cframe