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 |
|
|
|
| 12 Oct 2013 04:53 PM |
Yes you have to use a local script and
its like this
hit:GetMouse() |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 12 Oct 2013 05:47 PM |
| In a seat where the player sits. |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 12 Oct 2013 05:50 PM |
| Okay... So how would I fix the top? |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 12 Oct 2013 05:56 PM |
| Want me to write you an example? |
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
| |
|