I want to have a ball move when I hit W... I succesfully put in place the movement and I have the BodyVelocity in the script. I set the MaxForce and Velocity all to zero so when I'm not hitting w the ball will roll will gravity. The UserInputService is working but I get the error message "X cannot be assigned to"... thats it, it doesn't say what the coordinate x cannot be assigned to... Eventually I will have a system in place so the ball slows down with gravity instead of stopping immidiatly but here is what I have now. This is all in a local script.
local UIs = game:GetService('UserInputService')
local plr = game.Players.LocalPlayer
local Char = plr.Character or plr.CharacterAdded:Wait()
local Key = 'W'
UIs.InputBegan:Connect(function(Input, IsTyping)
if IsTyping then return end
local KeyPressed = Input.KeyCode
if KeyPressed == Enum.KeyCode[Key] then
script.Parent.BodyVelocity.Velocity.X = 50
script.Parent.BodyVelocity.MaxForce.X = 100
end
end)
