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
 

BodyVelocity halp

Previous Thread :: Next Thread 
memorycode is not online. memorycode
Joined: 24 Sep 2011
Total Posts: 3322
26 Jul 2015 02:48 PM
I have this inside of a local script

Instance.new("BodyVelocity", game.Workspace[game.Players.LocalPlayer.Name.."-Car"].CamLock)
local force = game.Workspace[game.Players.LocalPlayer.Name.."-Car"].CamLock.BodyVelocity
local cam = game.Workspace.CurrentCamera
local speed = 100
function SetSpeed(v, key)
force.velocity = v
end

local keys = {}
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:connect(function(key) keys[key] = true end)
mouse.KeyUp:connect(function(key) keys[key] = nil SetSpeed(Vector3.new(0,0,0), key) end)
while wait(.001) do
if keys["w"] then
force.velocity = (cam.CoordinateFrame.lookVector)*speed
end
end


in an attempt at making this brick move forward (corresponding with where the camera is looking) when you are pressing W. It does execute for when you press W and sometimes moves the brick, others not, it's really weird. No output, too.


Any help is appreciated. Thanks :)
Report Abuse
memorycode is not online. memorycode
Joined: 24 Sep 2011
Total Posts: 3322
26 Jul 2015 03:22 PM
Bump
Report Abuse
memorycode is not online. memorycode
Joined: 24 Sep 2011
Total Posts: 3322
26 Jul 2015 03:28 PM
:(
Report Abuse
memorycode is not online. memorycode
Joined: 24 Sep 2011
Total Posts: 3322
26 Jul 2015 03:35 PM
cri
Report Abuse
myactivetestplace is not online. myactivetestplace
Joined: 11 Jul 2015
Total Posts: 3733
26 Jul 2015 03:38 PM
local t = Instance.new("Tissue",memorycode.Hand)
Report Abuse
memorycode is not online. memorycode
Joined: 24 Sep 2011
Total Posts: 3322
26 Jul 2015 03:41 PM
t:clone().Parent = memorycode.Hand
Report Abuse
myactivetestplace is not online. myactivetestplace
Joined: 11 Jul 2015
Total Posts: 3733
26 Jul 2015 03:43 PM
local te = memorycode.Face
if memorycode.Face.Wet == true then
function showsympathy(hug)
hug.memorycode
end
end)
Report Abuse
memorycode is not online. memorycode
Joined: 24 Sep 2011
Total Posts: 3322
26 Jul 2015 03:46 PM
local hash = window.getHashToken()
function giveTissue()
local t = Instance.new("Tissue", memorycode.Hand)
end

function postBump(txt)
local f = game.GetService("Scripters"):PostReply(txt, hash)
if f then return else print("failed11111!111!11") end
end

local wet = true
repeat wait(30)
giveTissue()
postBump("Help me :(")
until not wet
Report Abuse
myactivetestplace is not online. myactivetestplace
Joined: 11 Jul 2015
Total Posts: 3733
26 Jul 2015 03:48 PM
Thread.Parent.Scripters.Position = Vector1.new(this thread)
Report Abuse
memorycode is not online. memorycode
Joined: 24 Sep 2011
Total Posts: 3322
26 Jul 2015 03:50 PM
function gatherHelp()
for i = 1, #game:GetService("ForumService").Viewing("Scripters")
game:GetService("ForumService").MoveTo(168903964, game:GetService("ForumService").Viewing("Scripters")[i])
end
end

while wait(5) do
gatherHelp()
end
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
26 Jul 2015 03:56 PM
Your code looks fine, albeit inefficient (you shouldnt' have a wait every .001 seconds, you should have it triggered by the event of pushing the W key.)
I haven't tested it, so I think before we can help you, you need to tell us a little more exactly what your problem is. Also, what is SetSpeed()?

-The [Guy]
Report Abuse
memorycode is not online. memorycode
Joined: 24 Sep 2011
Total Posts: 3322
26 Jul 2015 03:59 PM
I told you exactly what the problem is.

Sometimes it works and moves the brick, others not.

SetSpeed resets the force when the W key is released!
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
26 Jul 2015 04:05 PM
Alright, at this point I would add some Print statements when KeyDown is called and when KeyUp is called, or maybe just constantly print the value of keys['w'] to see if it's a problem with your values.

-The [Guy]
Report Abuse
memorycode is not online. memorycode
Joined: 24 Sep 2011
Total Posts: 3322
26 Jul 2015 07:29 PM
Bump
Report Abuse
memorycode is not online. memorycode
Joined: 24 Sep 2011
Total Posts: 3322
27 Jul 2015 05:43 PM
baaa
Report Abuse
myactivetestplace is not online. myactivetestplace
Joined: 11 Jul 2015
Total Posts: 3733
27 Jul 2015 07:11 PM
function bump()
threat.Position = top
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