Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why isn't my RC mobile adapation controls not working?

Asked by 2 years ago

I've got an issue I can't seem to fix. I'm trying to implement custom RC mobile controls into my game cause the default vehicleseat mobile controls suck.

I made it with gui buttons and a remoteevent to change the vehicleseat's throttle. It is really uncomfortable to use, and I can't see why it's doing this. It doesn't "stick" when I hold down the button, I have to press it multiple times.

GUI LocalScript:

local seat = script.Parent.Parent.seat
local send_rc = script.Parent.Parent.SEND_RC
    local function TOUCH(input, GPE)
        if input.UserInputState == Enum.UserInputState.Begin then
            send_rc:FireServer(1)
        else
            send_rc:FireServer(0)
        end
    end
    script.Parent.InputBegan:Connect(TOUCH)
    script.Parent.InputEnded:Connect(TOUCH)

RemoteEvent Server Script:

local SEND_RC = script.Parent.SEND_RC
local seat = script.Parent.seat
SEND_RC.OnServerEvent:Connect(function(plr, what)
    if what == -1 then
        seat.Value.ThrottleFloat = -1
    elseif what == 1 then
        seat.Value.ThrottleFloat = 1
    else
        seat.Value.ThrottleFloat = 0
    end
end)

Answer this question