|
| 16 Oct 2016 08:39 PM |
so i have been using Player = script.Parent.Script.Player.Value mouse = Player:GetMouse() Visibleval = script.Parent.Parent.Parent.Parent.Parent.Parent.Visibleval mouse.KeyUp:connect(function(key)
with some other things and it has not been working, it is saying that mouse is a nil value, can somebody please help?
|
|
|
| Report Abuse |
|
|
Lykaon
|
  |
| Joined: 27 Oct 2014 |
| Total Posts: 784 |
|
|
| 16 Oct 2016 08:41 PM |
you're identifying a value.
there is no such thing as a mouse in value
|
|
|
| Report Abuse |
|
|
|
| 16 Oct 2016 08:42 PM |
another thing, the script works in the studio test mode, but not in game
|
|
|
| Report Abuse |
|
|
|
| 16 Oct 2016 08:43 PM |
the value is the player, (an object value set by another script) and it usually works in studio but not in game.
|
|
|
| Report Abuse |
|
|
Lykaon
|
  |
| Joined: 27 Oct 2014 |
| Total Posts: 784 |
|
|
| 16 Oct 2016 08:46 PM |
you cant access the value cross-script like this unless its a table, _G, or a modulescript
|
|
|
| Report Abuse |
|
|
|
| 16 Oct 2016 08:50 PM |
can you help me? i will add you to team create, i just don't understand
|
|
|
| Report Abuse |
|
|
Lykaon
|
  |
| Joined: 27 Oct 2014 |
| Total Posts: 784 |
|
| |
|
|
| 16 Oct 2016 08:54 PM |
heres a link https://www.roblox.com/games/405145421/HungryBoy02s-Place-Number-9
|
|
|
| Report Abuse |
|
|
Dev_Ryan
|
  |
| Joined: 10 Mar 2013 |
| Total Posts: 243 |
|
|
| 16 Oct 2016 08:59 PM |
Since getting the mouse only works in a localscript, that means that each time you need to get the player, just do:
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse()
also if you want to get keys being pressed, use UserInputService instead of Mouse:KeyUp/KeyDown
local UIS = game:GetService("UserInputService") UIS.InputBegan:Connect(function(input) if input and input.UserInputType == Enum.UserInputType.Keyboard then if input.KeyCode == Enum.KeyCode.E then -- the E key, change this to whatever. -- do stuff when the key is held down end end end)
You can also get the end of the key press like so: UIS.InputEnded:Connect(function(input) if input and input.UserInputType == Enum.UserInputType.Keyboard then if input.KeyCode == Enum.KeyCode.E then -- the E key, change this to whatever. -- do stuff when the key is no longer held down. end end end)
|
|
|
| Report Abuse |
|
|