-
What do you want to achieve?
I want mobile to function normally after I morph the player. This is only a mobile issue, since everything works fine on PC (I have not checked console) -
What is the issue? Include screenshots / videos if possible!
The movement buttons/joystick (like jumping) don’t appear when I morph the player. They should appear. You can still move. Also (I’m assuming because of the same bug) when you move the camera moves.
Notice how when I spawn as the operator, I can still move around but there’s no joystick or jump button, and when I do move the camera moves with it. When I jump into the void and die, the bug is fixed. Not shown in the video but when I reset nothing changes. I have a script that morphs the character again when you die/reset, so that is why I assume. (The death script doesn’t trigger if you jump into the void, which won’t be a problem when the game is done)
These are the scripts that manage character spawning and changing the camera. They are both Module Scripts called by the module loader and other scripts when needed.
Player spawning script, in ServerScriptService
local SpawnService = {}
-- Script Variables --
local replicatedStorage = game:GetService("ReplicatedStorage")
local serverStorage = game:GetService("ServerStorage")
local customizationModule = require(replicatedStorage.Modules.CustomizationModule)
function SpawnService:Init()
-- Spawn Player / Set Operator --
replicatedStorage.Remotes.Spawn.OnServerEvent:Connect(function(plr,operatorName,skinTone)
-- Function Variables --
local Admins = {353146895, 917862938, 2262067327, 829451336, 3849471448, 3763933179}
local isAdmin = false
if table.find(Admins,plr.UserId) then isAdmin = true else end
-- Data Checks --
if typeof(operatorName) ~= "string" then warn(script.Name.. ": Invalid Input Type " ..typeof(operatorName).. "?! Try again.") return end
if typeof(skinTone) ~= "Color3" then warn(script.Name.. ": Invalid Input Type " ..typeof(skinTone).. "?! Try again.") return end
if operatorName == "UIU" then if isAdmin == false then warn(script.Name.. ": You do not have this operator?! Try again.") return end end
if not plr.PlayerGui.OperatorModels:FindFirstChild(operatorName,true) then warn(script.Name.. ": Operator " ..operatorName.. "Not Found?! Try again.") return end
-- Function Variables P2 --
local operator = plr.PlayerGui.OperatorModels:FindFirstChild(operatorName,true):Clone()
local character = plr.Character
local animate = plr.Character.Animate
animate.Parent = game.ReplicatedStorage
-- Destroy Unneccessary Parts of Model --
if operator.Torso:FindFirstChild("Gun") ~= nil then
operator.Torso:FindFirstChild("Gun"):Destroy()
end
operator:FindFirstChildWhichIsA("Animation"):Destroy()
-- Clone Important Scripts Into Model --
character.Health:Clone().Parent = operator
-- Set Operator Properties --
operator.Parent = workspace
customizationModule:setSkinTone(operator,skinTone)
operator.HumanoidRootPart.Anchored = false
operator.Name = " "
plr.Character = operator
animate.Parent = plr.Character
-- Fire Client For Client-Side Preparation --
replicatedStorage.Remotes.Spawn:FireClient(plr,operatorName)
-- Spawn Player --
local spawnPoints = workspace.SpawnPoints:GetChildren()
local target = spawnPoints[math.random(#spawnPoints)]
plr.Character.HumanoidRootPart.CFrame = target.CFrame
end)
end
return SpawnService
Camera managing script, in ReplicatedStorage
local cameraManager = {}
-- Script Variables --
local plr = game:GetService("Players").LocalPlayer
local plrCam = workspace.CurrentCamera
-- Functions --
function cameraManager:setCam(camType, camPart)
-- Set Player's Camera --
while wait() do
if (workspace.CurrentCamera.CameraType == camType) then
break
end
plrCam.CameraType = camType
end
if plrCam.CameraType ~= Enum.CameraType.Custom then
plrCam.CFrame = camPart.CFrame
end
print(script.Name.. ": " ..plr.Name.. "'s Camera Set")
end
return cameraManager
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’m not sure how to design my game for mobile, so I don’t really know where to begin looking. We do intend to support mobile though, which is why this has become an issue.