Ok, so am currently working on a game in which when the player is in the lobby the player is having the Normal 3D camera and the normal controls just like all the other roblox games. On the other hand when the player joins a level / stage in my game the player camera changes to like 2D or side scrolling as well as the controls they can only Move with the A and D key and space to jump.
Here’s the problem -: When the player comes back to the lobby like for example they completed the level and want to come back to the lobby, they came back and they should get the normal 3D camera and controls back. I’m done with the Normal camera and it works completely normal like the default camera but i’m not sure that how can i revert back to the Normal 3D Controls.
I tried making many script they din’t work and i also searched the whole forum and i couldn’t find a possible solution. So with no choice left i’m creating this post and hoping some someone could help me
if your still confused and don’t know what am i talking about here are some screenshots.
set camera mode back to classic if it isn’t already and set camera subject to humanoid(I will make a code for you real quick below if you don’t already know how to do it)
when the player is in 2D only the A and D key work cause 2D and when they go back to 3D i want the 3D controls back i managed to get back the camera doe.
I don’t really know your code but you did made the player only press a and d and space so if you know how to do that you should just do that but with the normal controls.
game.ReplicatedStorage.RemoteEvents.ChangeControls.OnClientEvent:Connect(function()
local player = game.Players.LocalPlayer
local RunService = game:GetService("RunService")
local ContextActionService = game:GetService("ContextActionService")
local jumping = false
local leftValue, rightValue = 0, 0
local function onLeft(actionName, inputState)
if inputState == Enum.UserInputState.Begin then
leftValue = 1
elseif inputState == Enum.UserInputState.End then
leftValue = 0
end
end
local function onRight(actionName, inputState)
if inputState == Enum.UserInputState.Begin then
rightValue = 1
elseif inputState == Enum.UserInputState.End then
rightValue = 0
end
end
local function onJump(actionName, inputState)
if inputState == Enum.UserInputState.Begin then
jumping = true
elseif inputState == Enum.UserInputState.End then
jumping = false
end
end
local function onUpdate()
if player.Character and player.Character:FindFirstChild("Humanoid") then
if jumping then
player.Character.Humanoid.Jump = true
end
local moveDirection = rightValue - leftValue
player.Character.Humanoid:Move(Vector3.new(moveDirection,0,0), false)
end
end
RunService:BindToRenderStep("Control", Enum.RenderPriority.Input.Value, onUpdate)
ContextActionService:BindAction("Left", onLeft, true, "a", Enum.KeyCode.Left, Enum.KeyCode.DPadLeft)
ContextActionService:BindAction("Right", onRight, true, "d", Enum.KeyCode.Right, Enum.KeyCode.DPadRight)
ContextActionService:BindAction("Jump", onJump, true , Enum.KeyCode.Space, Enum.KeyCode.Up, Enum.KeyCode.DPadUp, Enum.KeyCode.ButtonA)
end)
here’s the code please trying to help this is the 2D controls. code.
sorry It kinda late for me now but if you still have this problem by tommorow I will help you tommorow but try to search up for normal player control script or something like that.
Looking at your code, I think you would just use the RunService:UnbindToRenderStep(“Control”) and ContextActionService:UnbindAllActions() functions to revert to default controls.
I’m currently working on a game similar to yours and wow! Your levels and map are way better. I was going to make a map similar to the New Super Mario Bros. Wii map. That map wouldn’t need to revert to 3D controls because it’s 2.5D.
Well, not entirely. Your script runs when the server fires the game.ReplicatedStorage.RemoteEvents.ChangeControls event for the player. You would need another remote event, or rewrite your code as a toggle function to change back to the standard controls.
It would probably be easiest to make a new event in the RemoteEvents folder, call it say ResetControls, and then do something like:
local RunService = game:GetService("RunService")
local ContextActionService = game:GetService("ContextActionService")
RunService:UnbindToRenderStep("Control")
ContextActionService:UnbindAllActions()
end)
Then you would need to fire the ResetControls event from a server side script in order to run the above code.