Mobile support (Please help) How would I add another line of code for mobile please I been stressing for 2 days i also been reading the wiki

ServerControl.OnServerInvoke = (function(Player, Mode, Value)
if Mode == “KeyPress” and Value then
local Key = string.lower(Value.Key)
local ByteKey = string.byte(Key)
local Down = Value.Down
if Key == “w” or ByteKey == 17 then
Controls.Forward = Down
while Controls.Forward and ToolEquipped do
CurrentSpeed = math.min(CurrentMaxSpeed, (CurrentSpeed + (Acceleration * (1 / 30))))
wait(1 / 30)
end
elseif Key == “a” or ByteKey == 20 then
Controls.Left = Down
while Controls.Left and ToolEquipped do
TurnSpeed = math.min(5, (TurnSpeed + (TurnAlpha)))
wait(1 / 30)
end
elseif Key == “s” or ByteKey == 18 then
Controls.Backward = Down
while Controls.Backward and ToolEquipped do
if CurrentSpeed > 0 then
CurrentSpeed = math.max(-20, (CurrentSpeed - (Deceleration * 2.8 * (1 / 30))))
else
CurrentSpeed = math.max(-20, (CurrentSpeed - (Deceleration * (1 / 30))))
end
wait(1 / 30)
end
elseif Key == “d” or ByteKey == 19 then
Controls.Right = Down
while Controls.Right and ToolEquipped do
TurnSpeed = math.max(-5, (TurnSpeed - (TurnAlpha)))
wait(1 / 30)
end
elseif Key == " " and Down then
if (LastSpace == 0 or (tick() - LastSpace) > 1.9) then
LastSpace = tick()
local BodyForce = Instance.new(“BodyForce”)
BodyForce.force = Vector3.new(0, (((GetTotalMass(Character) * Gravity) * 4) * 4), 0)
Debris:AddItem(BodyForce, 0.1)
BodyForce.Parent = FakeHandle
end
elseif Key == “h” and Down then
Sounds.Bell:Play()
end
end
end)

function InvokeClient(Mode, Value)
local ClientReturn = nil
pcall(function()
ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
end)
return ClientReturn
end

Please refer back to About the Scripting Support category for information and guidelines on what you should be including in a support topic. Your thread is very unclear and is improper use of the category. You should not dump an entire code block and expect others to fix it for you.

The following changes should be applied:

  • A clear title reflecting the contents of the thread
  • A question regarding what you need help with and what the problem is
  • What you’ve tried so far to resolve your problem

I just dont know how to revert that to mobile control i been looking at the wiki man

If I’m understanding you correctly, you want to make this game mobile friendly.

  1. To do that, I would recommend using GUI Buttons inside of a ScreenGui.

  2. Set enabled to false on the ScreenGui. If you detect that the player is on a mobile device, enable the ScreenGui. (You can use UserInputService to determine if you need to enable the ScreenGui.)

  3. Whenever the appropriate GuiButton is activated, execute the code corresponding to that button.

Let me know if this is the info you were looking for!

1 Like

Wow I figure it out wow thanks so much cuz

1 Like

Yeah, glad I could help! I edited my post to improve its structure so hopefully it is easier to reference in the future. Good luck on your game!

Please follow category guidelines in the future:

Don’t just dump code expecting people to help you out.