Scripts / [SOLVED] Using a different player movement script only for a specific project?

Author
Message
_PlayerV
3
Years of Service
User Offline
Joined: 16th Oct 2020
Location: Netherlands
Posted: 28th Jan 2023 12:58
I've created my own custom player movement script, but I'd like to use it only in a specific project while keeping the default player movement system for other projects.
Does anyone know how I could achieve this?

The author of this post has marked a post as an answer.

Go to answer
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 28th Jan 2023 14:19
This post has been marked by the post author as the answer.
gameplayercontrol is a global so you can simple overwrite it with your own version, i.e.:

gameplayercontrol = require "scriptbank\\yourgameplayercontrol"

As long as you do this in one of your in-game scripts it should replace the default.

I would do this with a bit of logic to ensure that regardless of timing your version will always persist, i.e. in an always active script:

local mygpc = require "scriptbank\\mygameplayercontrol"

... in _main function:

if mygpc ~= gameplayercontrol then gameplayercontrol = mygpc end

Make sure this is only present in *one* script though!
Been there, done that, got all the T-Shirts!
PM

Login to post a reply

Server time is: 2024-02-22 04:23:51
Your offset time is: 2024-02-22 04:23:51