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

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

1 Like

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.

1 Like

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.

3 Likes

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

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.

6 Likes

@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?

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.

1 Like

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

2 Likes

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.

1 Like

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.

1 Like

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

5 Likes

When will this be live?

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.

1 Like

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.
https://i.imgur.com/VzSLegI.mp4

3 Likes

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

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.

6 Likes

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.

1 Like

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.

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.

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

2 Likes