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: Getting the mouse.

Previous Thread :: Next Thread 
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
12 Oct 2013 04:50 PM
This is just two lines of a script with a lot of lines, But here is two lines.

local hitplayer = game.Players:playerFromCharacter(item.Part1.Parent)
mouse = hitplayer.Mouse


Would this get the mouse?
OR do I have to use a local script.
Report Abuse
gaddafisux is not online. gaddafisux
Joined: 18 Mar 2011
Total Posts: 154
12 Oct 2013 04:53 PM
Yes you have to use a local script and

its like this

hit:GetMouse()
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
12 Oct 2013 04:55 PM
Im going to make this so it works, but like this? Its in a local script.


seat = script.Parent
gyro = Instance.new("BodyGyro")
gyro.Parent = seat
player = game.Players.LocalPlayer
mouse = player:GetMouse()

function keydown(key)
if key == "e" then
gyro.CFrame = CFrame.new(seat.Position,pos) * CFrame.fromEulerAnglesXYZ(-3.14/2+1.2,0,0)
end
end



mouse.KeyDown:connect(keydown)
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
12 Oct 2013 05:00 PM
This is the entire script. and NOTHING works but there is no output.
-------------------------------------------
function sitting()
local w = script.Parent:findFirstChild("SeatWeld")
if w ~= nil then
w.C0 = CFrame.new(0,-3.7,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)
end
end
------------------------------------------
seat = script.Parent
gyro = Instance.new("BodyGyro")
gyro.Parent = seat
player = game.Players.LocalPlayer
mouse = player:GetMouse()

function keydown(key)
if key == "e" then
gyro.CFrame = CFrame.new(seat.Position,pos) * CFrame.fromEulerAnglesXYZ(-3.14/2+1.2,0,0)
end
end

mouse.KeyDown:connect(keydown)
script.Parent.ChildAdded:connect(sitting)
Report Abuse
janthran is not online. janthran
Joined: 15 May 2009
Total Posts: 17429
12 Oct 2013 05:01 PM
local hitplayer = game.Players:playerFromCharacter(item.Part1.Parent)
The method is
game.Players:GetPlayerFromCharacter(char)
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
12 Oct 2013 05:03 PM
@ Jan, Thats old I already have a better one than that when I chagned it to a local script.
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
12 Oct 2013 05:32 PM
?
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
12 Oct 2013 05:34 PM
"-3.14/2"

you know, you can always do -math.pi/2
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
12 Oct 2013 05:35 PM
Ignore the numbers.

The script does nothing at all. No output. Not even the top part does anything.
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
12 Oct 2013 05:43 PM
So wait,
A. Where is this script located at?

B. This is the entire script?
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
12 Oct 2013 05:47 PM
This is the 100% Entire script. Nothing works, the top part doesn't.


function sitting(person)
local w = script.Parent:findFirstChild("SeatWeld")
if w ~= nil then
w.C0 = CFrame.new(0,-3.7,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)
end
end

seat = script.Parent
gyro = Instance.new("BodyGyro")
gyro.Parent = seat
player = game.Players.LocalPlayer
mouse = player:GetMouse()

function keydown(key)
if key == "e" then
gyro.CFrame = CFrame.new(seat.Position,pos) * CFrame.fromEulerAnglesXYZ(-3.14/2+1.2,0,0)
script.Parent.Fire.Trasparency = math.random(0,.9)
script.Parent.Fire1.Trasparency = math.random(0,.9)
script.Parent.Fire2.Trasparency = math.random(0,.9)
end
end

mouse.KeyDown:connect(keydown)
script.Parent.ChildAdded:connect(sitting)
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
12 Oct 2013 05:47 PM
In a seat where the player sits.
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
12 Oct 2013 05:50 PM
Well... mon frère, ChildAdded doesn't work in localscripts.
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
12 Oct 2013 05:50 PM
Okay... So how would I fix the top?
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
12 Oct 2013 05:55 PM
I guess use separate scripts for the top part, and the bottom part.

You would enable the localscript if the child added is the seat weld
and add connect the ChildRemoved event.

You can connect the two scripts by using the ObjectValue when the seatweld is added by making the ObjectValue.Value = script.Parent.SeatWeld.Part1.Parent.

And disable the script if the ChildRemoved returns the seat weld.
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
12 Oct 2013 05:56 PM
Want me to write you an example?
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
12 Oct 2013 05:58 PM
No No, well if I say so.
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