So I am having a very large problem, that I have no idea how to fix.
Once implementing the code, I noticed that part of the mobile interface had disapeared, only the JumpButton and Joystick. (ALSO… the joystick and jumpbutton only disapears when in the Roblox Player not in the Roblox Studio Player)
After moving UIs back and forth from StarterGUI to ServerStorage to find out what caused this random problem, I found this script:
local player = game.Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SpawnCarEvent = game.ReplicatedStorage:WaitForChild("SpawnCar")
local DeleteCarEvent = game.ReplicatedStorage:WaitForChild("DeleteCar")
local CarParams = game.ReplicatedStorage:WaitForChild("GetCarParams"):InvokeServer(script.Parent.Name)
local carName = script.Parent.Name
script.Parent.CarName.Text = CarParams.Name
local CarImage
for i, v in pairs(game.Players.LocalPlayer.PlayerGui.DealershipScreen.CarLibrary.Sections:GetDescendants()) do
if v:IsA("ViewportFrame") and v.Name == script.Parent.Name then
CarImage = v.CarImage
end
end
local clonedCarImage = CarImage:Clone()
clonedCarImage.Parent = script.Parent
clonedCarImage.Position = UDim2.new(0.5, 0, 0.5, 0)
clonedCarImage.AnchorPoint = Vector2.new(0.5, 0.5)
clonedCarImage.Size = UDim2.new(1, 0, 1, 0)
clonedCarImage.ZIndex = 31
clonedCarImage.Name = "CarImage"
script.Parent.MouseButton1Down:Connect(function()
script.Parent.Parent.Parent.Parent.Parent:TweenPosition(UDim2.new(0.5,0,-1.5,0),Enum.EasingDirection.In,Enum.EasingStyle.Back,1,true);
script.Parent.Parent.Parent.Parent.Parent.IsOpen.Value = false
local CurrentCar = game.Workspace:FindFirstChild(player.Name .. "sCar")
if not CurrentCar then
SpawnCarEvent:FireServer(carName)
else
for i, v in pairs(CurrentCar:GetDescendants()) do
if v:IsA("VehicleSeat") or v:IsA("Seat") then
if v.Occupant and v.Occupant:IsA("Humanoid") then
v.Occupant.Sit = false
end
end
end
wait()
DeleteCarEvent:FireServer(CurrentCar)
SpawnCarEvent:FireServer(carName)
end
end)
then, I managed to confine it down to this part to find out what was causing it:
for i, v in pairs(game.Players.LocalPlayer.PlayerGui.DealershipScreen.CarLibrary.Sections:GetDescendants()) do
if v:IsA("ViewportFrame") and v.Name == script.Parent.Name then
CarImage = v.CarImage
end
end
Of which i found out that if I delete the if then statement, the joystick and jump button come back.
However, I have no idea at all how this could be occuring. Everywhere I look I can’t find a solution and everyone I ask have no idea how or why this is happening, and I can’t see what is occuring to the Joystick and JumpButton since it doesn’t happen in Roblox Studio, but only on mobile. Why is this occuring?