So, this is a bit of a weird thing to work with and it’s been pretty daunting for me to look at, but I’ve been trying to make the really old DEFAULT Roblox Skateboard actually mobile friendly.
This is the function in the script that appears to handle just generally moving around:
function Equipped(humanoid, controller)
trickdb = false
grab = false
Controller = controller
Humanoid = humanoid
Character = Humanoid.Parent
Player = Players:GetPlayerFromCharacter(Character)
PlayerGui = Player:FindFirstChild("PlayerGui")
Torso = Character:FindFirstChild("HumanoidRootPart")
script.Parent.Parent.Parent = Character
if not CheckIfAlive() then
return
end
for i, v in pairs({KeyDownConnection, KeyUpConnection}) do
if v then
v:disconnect()
end
end
for i, v in pairs({Animations.R6, Animations.R15, Sounds}) do
for ii, vv in pairs(v) do
if vv:IsA("Animation") then
ContentProvider:Preload(vv.AnimationId)
elseif vv:IsA("Sound") then
ContentProvider:Preload(vv.SoundId)
end
end
end
KeyDownConnection = UserInputService.InputBegan:connect(function(InputObject)
if InputObject.UserInputState == Enum.UserInputState.Begin then
InvokeServer("KeyPress", {Down = true, Key = InputObject.KeyCode})
end
end)
KeyUpConnection = UserInputService.InputEnded:connect(function(InputObject)
if InputObject.UserInputState == Enum.UserInputState.End then
InvokeServer("KeyPress", {Down = false, Key = InputObject.KeyCode})
end
end)
for i, v in pairs(Board:GetChildren()) do
if v:IsA("BodyThrust") or v:IsA("BodyGyro") then
v:Destroy()
end
end
SkateboardEquipped = true
bf = Instance.new("BodyForce",Board)
bf.Force = Vector3.new(0,400,0)
MakeOllieThrust()
MakeGyro()
Controller.AxisChanged:connect(AxisChanged)
Board.MoveStateChanged:connect(MoveStateChanged)
Controller:BindButton(Enum.Button.Jump, "")
Controller.ButtonChanged:connect(ButtonChanged)
SetAnimation("Play", {Animation = GetAnimation("CoastingPose")})
InvokeServer("Equipped", Character)
end
I feel like a lot of this is deprecated or there could just be an easier way of accomplishing what I need in a separate function, but I’m trying to make the movement thumbstick on mobile be compatible with movement on the skateboard. I’ve stared and stared at the forum post over syntax with CAS and I /kind/ of understand what its doing, but it’s just filling in the spot in the function with what I need to do.
Shouldn’t I be able to modify the given code to where it would work with mobile?