-
I want to make on screen buttons on a for mobile to make it easier to drive a car
-
I’ve tried making gui buttons but they were delayed. I also
Tryed using the ContextActionService but sense it was a local script
I wasn’t sure how to us it.
PS I want to set the seat throttle with a on screen buttons.
this is my code
local ContextActionService = game:GetService("ContextActionService")
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local val = Player.Value
local function handleAction(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
if val.Value ~= "nil" then
local seat = workspace[val.Value][val.Value]
print(seat)
seat.Steer = 1
seat.SteerFloat = 1
print(seat.Steer)
end
end
end
-- Bind action to function
ContextActionService:BindAction("Interact", handleAction, true, Enum.KeyCode.W, Enum.KeyCode.ButtonR1)
--- sense its a local script it cant set the steer on the seat thats my problom