|
| 19 Dec 2015 10:44 AM |
| How would I make a script that detects what the player is looking at, and if the object has a IntValue called "interactive" set to 1 then it fires a function called Blah() |
|
|
| Report Abuse |
|
|
Waccsadac
|
  |
| Joined: 02 Jun 2012 |
| Total Posts: 2440 |
|
|
| 19 Dec 2015 10:48 AM |
havent tested
local cam=workspace.CurrentCamera workspace.CurrentCamera.Changed:connect(function() local check= Instance.new("Part",workspace) check.CFrame=cam.Focus local touched = check:GetTouchingParts for i=1, #touched do if touched[i].interactive == 1 then Blah() return end end end) |
|
|
| Report Abuse |
|
|
Waccsadac
|
  |
| Joined: 02 Jun 2012 |
| Total Posts: 2440 |
|
|
| 19 Dec 2015 10:49 AM |
before return do test:Destroy()
|
|
|
| Report Abuse |
|
|
|
| 19 Dec 2015 10:58 AM |
| So this pretty much just creates an invisible part touching where the player is looking then it calls the part from there? Seems very inefficient... |
|
|
| Report Abuse |
|
|
Waccsadac
|
  |
| Joined: 02 Jun 2012 |
| Total Posts: 2440 |
|
|
| 19 Dec 2015 11:02 AM |
i could probably find a more efficient way brb
|
|
|
| Report Abuse |
|
|