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

playerscripts

#64

PlayerModule:GetControls() returns nil. In the old module enabling and disabling the controllers would not lead to anything breaking. What would I exactly do to make it so I can enable and disable the controllers from different localscripts requiring the module without having the bug of not being able to enable it again?

How would you go about enabling the controllers when resetting? It seems to break the controllers sometimes when set to enabled.


#65

You have to require the module to use it’s returned functions.


#66

It is.


#67

You require’d the ControlModule, not the PlayerModule. The error that you are seeing is because you are trying to perform “:GetControls()” on the literal PlayerModule instance instead of the returned code.


#68

My pal said this.


#69

One of my old feature requests about controlscripts has been gaining attention again for some reason (it just reached 100 likes)- any chance this could be considered for the PlayerScripts refactor? Adding a built-in way to let us have the default character controls’ arrow keys act like WASD (or vice versa) without having to fork would be handy. Certain games use fixed cameras & the arrow keys only let you move up & down in that case, and a default setting to have the camera move with the mouse without having to hold right-click (without being a toggle-able, auto-strafing mode like shiftlock) would also be handy for creators and players alike.


#70

I know this has been brought up, but Tweening the Camera CFrame is still broken when I try to test it in Play Solo… Is there a fix I’m not seeing?
The problem is I need the camera to zoom in on something, but when I try to do that it seems to bounce forward:

It didn’t do this before the player scripts update, and I saw in a bunch of threads from about 2 weeks ago that this was supposed to be fixed, has that happened yet? I haven’t seen any mention of it, and it seems to work in a real game, but testing it is really annoying…


#71

It’s an issue with poppercam as far as I know, it compeltely wrecked a few of my game’s aspects as well.
So I hope a fix for this will come out very soon.


#72

Like the others above, you are also using require on the ModuleScript in StarterPlayerScripts. Requiring the modules in StarterPlayerScripts is going to start second copies of these controllers running and conflicting with the ones that are already in use (the ones Clone()'d to Players.LocalPlayer.PlayerScripts). Scripts in “Starter” places like StarterPlayerScripts, StarterCharacterScripts, and StarterGui are not executed, the client always clones scripts from these locations onto your player, and those are the copies that are actually executed.


#73

As others have already pointed out, your screenshot shows that you are missing a require. Specifically, the line

local PlayerModule = PlayerScripts:WaitForChild("PlayerModule",10)

should be:

local PlayerModule = require(PlayerScripts:WaitForChild("PlayerModule"))

#74

Just a heads up, since it seems to be a fairly common mistake to make–requiring modules from StarterPlayerScripts–and the resulting bugs are difficult to diagnose if you don’t know what you’ve done wrong, I’m probably going to add a safeguard against this to the top of each of the player scripts ModuleScripts, something like this:

if script:FindFirstAncestorOfClass("StarterPlayerScripts") ~= nil then
    error("Do not require modules directly from StarterPlayerScripts, require the copies cloned under Players.LocalPlayer.PlayerScripts")
    return nil
end

#75

We sorted out the require yesterday but the main problem is to re-enable the controllers again as it seems to break. Let’s for instance say that you disable the controllers but then a player kills you and you die. The controllers still will be disabled after respawn. Even if there is a localscript that replicates inside the character each time you spawn in, that enables the movement using the ControlModule:Enable(), it seems to break every so often and still make the player not able to move. This is only fixed once the player rejoins. Would the right thing to do be to require the current controllers from playermodule and then enable it? That seems to also break sometimes.

Thanks.


#76

Able to get any feedback on this? @AllYourBlox


#77

Is this supposed to return nil or is the comment wrong? (This is in the Control Module)