laczka
|
  |
| Joined: 26 Jan 2015 |
| Total Posts: 258 |
|
|
| 28 Aug 2016 08:17 PM |
I am making coffee machines, the main local script for a client player is supposed to check when you clicked, and then get your local mouse.Target to determine if you really clicked the on/off button. And the thing is, it works immaculately in-studio testing mode, but when you go to play the actual game on your ROBLOX client (in-game) it does nothing! It seems as if it fails to check local mouse.Target when you are in-game. The game is filtering enabled, maybe that is my problem? Maybe I should use a remote function for this? did ROBLOX deprecate the mouse.Target method? I am completely stumped right now, if anyone could help me out I would really appreciate it. Here is the fundamental source code in the local script: local r = game:GetService("ReplicatedStorage").RemoteEvent local plr = game.Players.LocalPlayer local m = plr:GetMouse() local debounce = false m.Button1Down:connect(function() if debounce == false then debounce = true if (m.Target ~= nil and m.Target.Name == "OnOff" and m.Target.Parent:IsA("Model") and _G.on == false) then if (plr:IsInGroup(2906079) and plr:GetRankInGroup(2906079) >= 4) then r:FireServer(plr.Name.." 0x00") end end debounce = false end end)
--[[Notes: 1:In case anyone is wondering, I checked if the on/off button's parent is a model because it resides within the coffeemachine model. 2:In case anyone is wondering why fired the server with plr.name and 0x00 in hexadecimal, it is because I decided to use a code to determine what function the server side coffee machine script would run upon being fired the clients name, the server script looks for an 0x00, 0x01, or an 0x02 to determine the global function that it will run.]] |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2016 08:18 PM |
because
m.Button1Down
use user input service |
|
|
| Report Abuse |
|
|
laczka
|
  |
| Joined: 26 Jan 2015 |
| Total Posts: 258 |
|
|
| 28 Aug 2016 08:19 PM |
| thanks blarg I will try userInputService and see if it works. |
|
|
| Report Abuse |
|
|
aagg11
|
  |
| Joined: 11 Feb 2010 |
| Total Posts: 487 |
|
|
| 28 Aug 2016 08:30 PM |
| Yeah that happend to me too and my friend got it working for me. |
|
|
| Report Abuse |
|
|
laczka
|
  |
| Joined: 26 Jan 2015 |
| Total Posts: 258 |
|
|
| 28 Aug 2016 08:31 PM |
| my only question now is what event in userInputService can determine a mouse click. |
|
|
| Report Abuse |
|
|
laczka
|
  |
| Joined: 26 Jan 2015 |
| Total Posts: 258 |
|
|
| 28 Aug 2016 08:44 PM |
Nope, I am still having the same problem. I changed the local script mouse click event to: local r = game:GetService("ReplicatedStorage").rev local plr = game.Players.LocalPlayer local m = plr:GetMouse() local debounce = false game:GetService("UserInputService").InputBegan:connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then if debounce == false then debounce = true if (m.Target ~= nil and m.Target.Name == "OnOff" and m.Target.Parent:IsA("Model") and _G.on == false) then if (plr:IsInGroup(2906079) and plr:GetRankInGroup(2906079) >= 4) then r:FireServer(plr.Name.." 0x00") end end debounce = false end end end) but it is still behaving the same way where is works perfectly in-studio, but it doesn't work at all in-game. Anymore help would be greatly appreciated. |
|
|
| Report Abuse |
|
|
laczka
|
  |
| Joined: 26 Jan 2015 |
| Total Posts: 258 |
|
| |
|