generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Why isn't this working?

Previous Thread :: Next Thread 
fiterpilot is not online. fiterpilot
Joined: 31 Mar 2012
Total Posts: 135
28 Aug 2015 08:40 PM
I have a script inside of a part I named "Cube" in the workspace. There is a part attached to it with the name of the character. I'm trying to make a script that moves the cube around when someone pushes WASD. For some reason the script isn't working, any help?

script.Parent:WaitForChild("Name1")
local cube = script.Parent
local name1 = script.Parent.Name1

game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.W then
cube.CFrame = cube.CFrame + CFrame.new(0.1, 0, 0)
name1.CFrame = cube.CFrame + CFrame.new(0.1, 0, 0)
end
if inputObject.KeyCode == Enum.KeyCode.S then
cube.CFrame = cube.CFrame - CFrame.new(0.1, 0, 0)
name1.CFrame = cube.CFrame - CFrame.new(0.1, 0, 0)
end
if inputObject.KeyCode == Enum.KeyCode.A then
cube.CFrame = cube.CFrame - CFrame.new(0, 0, 0.1)
name1.CFrame = cube.CFrame - CFrame.new(0, 0, 0.1)
end
if inputObject.KeyCode == Enum.KeyCode.A then
cube.CFrame = cube.CFrame + CFrame.new(0, 0, 0.1)
name1.CFrame = cube.CFrame + CFrame.new(0, 0, 0.1)
end
end)
Report Abuse
Robin5D is online. Robin5D
Joined: 03 Dec 2011
Total Posts: 227
28 Aug 2015 08:48 PM
Output say anything?


If not, this might work:
script.Parent:WaitForChild("Name1")
local cube = script.Parent
local name1 = script.Parent.Name1

game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.W & script.Parent.name1.Value == "InsertNameHere" then then
cube.CFrame = cube.CFrame + CFrame.new(0.1, 0, 0)
name1.CFrame = cube.CFrame + CFrame.new(0.1, 0, 0)
end
if inputObject.KeyCode == Enum.KeyCode.S & script.Parent.name1.Value == "InsertNameHere" then then
cube.CFrame = cube.CFrame - CFrame.new(0.1, 0, 0)
name1.CFrame = cube.CFrame - CFrame.new(0.1, 0, 0)
end
if inputObject.KeyCode == Enum.KeyCode.A & script.Parent.name1.Value == "InsertNameHere" then
cube.CFrame = cube.CFrame - CFrame.new(0, 0, 0.1)
name1.CFrame = cube.CFrame - CFrame.new(0, 0, 0.1)
end
if inputObject.KeyCode == Enum.KeyCode.A & script.Parent.name1.Value == "InsertNameHere" then
cube.CFrame = cube.CFrame + CFrame.new(0, 0, 0.1)
name1.CFrame = cube.CFrame + CFrame.new(0, 0, 0.1)
end
end)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image