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 » Scripting Helpers
Home Search
 

Re: Finding the local player when he/she selected the tool?

Previous Thread :: Next Thread 
DriftCityX is not online. DriftCityX
Joined: 15 Dec 2013
Total Posts: 40
21 Dec 2013 03:02 AM
Is anything possible like this? i couldn't find any article about this on the wiki ?
Report Abuse
shotgreen999 is not online. shotgreen999
Joined: 29 Nov 2009
Total Posts: 376
21 Dec 2013 03:06 AM
Yes this is definitely possible but I would need more info to help.
Report Abuse
Arkose is not online. Arkose
Joined: 26 May 2013
Total Posts: 745
21 Dec 2013 03:10 AM
game.Players.LocalPlayer?






~ắṝḱờṧἓ
Report Abuse
DriftCityX is not online. DriftCityX
Joined: 15 Dec 2013
Total Posts: 40
21 Dec 2013 03:16 AM
Okay here are the details:
Note: The model i'm using is a miniature truck that i made out of 5 parts.

The Model I Will Use:
Truck
-Movement (script)
-Weld (script)
-Body (part)
-Body (part)
-Wheel (part)
-Wheel (part)
-Window (part)

The Tool:
Truck(hopperbin)
-Movement(Script to make the car move since it doesn't have a seat)

The objective:

When the tool is selected, a script will find the selector of the tool and make the camerasubject change to Window (The Truck's Window) after the tool is selected the tool will visually be invisible but not physically so the car would still work.

for more details here is the script for the movement:


body = script.Parent.Body.BodyForce
Wheel = script.Parent.Wheel.BodyForce
Window = script.Parent.Window.BodyForce
truck = game.Lighting.Truck
player = game.Players.LocalPlayer.Character
--Functions_and_Keys
local tool = game.Players.LocalPlayer.Backpack.Truck
--Getting_The_Model_Regen
tool.Selected:connect(function(truck)
model = game.Lighting.Truck
backup = model:clone()
model = backup:clone()
model.Parent = game.Workspace
model:MoveTo(-41.8, 2.19, -112.6)
model:makeJoints()
model.Name = player.Name
--End_Of_Model_Regen
player.Parent = model
tool.Selected:connect(function(mouse)
mouse.KeyDown:connect(function(key)
if key == "w" then
body.force = Vector3.new(0, 0, 1)
Wheel.force = Vector3.new(0, 0, 1)
Window.force = Vector3.new(0, 0, 1)
else
body.force = Vector3.new(0, 0, 0)
Wheel.force = Vector3.new(0, 0, 0)
Window.force = Vector3.new(0, 0, 0)
if key == "s" then
body.force = Vector3.new(0, 0, -1)
Wheel.force = Vector3.new(0, 0, -1)
Window.force = Vector3.new(0, 0, -1)
else
body.force = Vector3.new(0, 0, 0)
Wheel.force = Vector3.new(0, 0, 0)
Window.force = Vector3.new(0, 0, 0)
if key == "a" then
body.force = Vector3.new(1, 0, 0)
Wheel.force = Vector3.new(1, 0, 0)
Window.force = Vector3.new(1, 0, 0)
else
body.force = Vector3.new(0, 0, 0)
Wheel.force = Vector3.new(0, 0, 0)
Window.force = Vector3.new(0, 0, 0)
if key == "d" then
body.force = Vector3.new(1, 0, 0)
Wheel.force = Vector3.new(1, 0, 0)
Window.force = Vector3.new(1, 0, 0)
else
body.force = Vector3.new(0, 0, 0)
Wheel.force = Vector3.new(0, 0, 0)
Window.force = Vector3.new(0, 0, 0)
end
end
end
end
end)
end)
end)

one error in it is that the car wont regenerate idk why...no output!
Report Abuse
shotgreen999 is not online. shotgreen999
Joined: 29 Nov 2009
Total Posts: 376
21 Dec 2013 03:25 AM
player = game.Players.LocalPlayer.Character
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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