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

My part is not moving in a diagonal direction when two buttons are pressed at the same time?

Asked by 3 years ago
01function droneMovement(player,keypressed,direction)
02    local dronecframe = drone.CFrame
03 
04    if keypressed == "w" then
05        Bodypos.Position = dronecframe:PointToWorldSpace(Vector3.new(0,0,-3))
06 
07 
08    elseif keypressed == "a" then
09        Bodypos.Position = dronecframe:PointToWorldSpace(Vector3.new(-3,0,0))
10 
11 
12    elseif keypressed == "s" then
13        Bodypos.Position = dronecframe:PointToWorldSpace(Vector3.new(0,0,3))
14 
15    elseif  keypressed == "d" then
View all 35 lines...

thats the ^ server script where everything moves in the server

01function drone.dronemovement()
02    local validKeys = {
03        ["W"] = function()
04            droneserver:FireServer("w")
05        end,
06        ["A"] = function()
07            droneserver:FireServer("a")
08        end,
09        ["S"] = function()
10            droneserver:FireServer("s")
11 
12        end,
13        ["D"] = function()
14            droneserver:FireServer("d")
15 
View all 39 lines...

This is the module script where i am trying to get the part to move when in a diagonal direction when when for example W+A is pressed at the same time on the keyboard.

Answer this question