|
| 26 Oct 2016 09:59 PM |
| I'm trying to fix a abusive glitch where the user can stick their camera towards the wall to the point where the camera goes through and you can click the Part with ClickDetector and open it from the inside. Any way I can fix this? |
|
|
| Report Abuse |
|
|
| |
|
pidgey
|
  |
| Joined: 16 Jan 2008 |
| Total Posts: 2739 |
|
|
| 26 Oct 2016 11:02 PM |
| create a raycast from the middle of the character who clicks the clickdetector to the button, if the raycast doesnt hit the wall then continue the function |
|
|
| Report Abuse |
|
|
|
| 26 Oct 2016 11:14 PM |
@pidgey
I know I can do that, but what if the Player isn't facing the wall and clicks it? |
|
|
| Report Abuse |
|
|
pidgey
|
  |
| Joined: 16 Jan 2008 |
| Total Posts: 2739 |
|
|
| 26 Oct 2016 11:17 PM |
| if the raycast hits the wall then return false, if you mean that if the characters front face is facing the button while clicking it to continue, then youll need someone smarter to help cuz idk |
|
|
| Report Abuse |
|
|
|
| 26 Oct 2016 11:28 PM |
| I need a way to be able to make the ClickDetector check if a Player is infront of it, a Raycast may not be able to do that since you have to be directly infront of it. |
|
|
| Report Abuse |
|
|
pidgey
|
  |
| Joined: 16 Jan 2008 |
| Total Posts: 2739 |
|
|
| 26 Oct 2016 11:50 PM |
i.imgur /iEA1DYP
something like this? |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2016 12:13 AM |
| Yes, that's a bit like I wanted to do, I had another thing in mind but this is good and I have a feeling I know how to do it. |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2016 12:18 AM |
| Make the wall really thick |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2016 01:03 AM |
| The direction the player is facing should not matter, just create a ray between the player and the button and check if it hits anything. |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2016 01:06 AM |
| Oh also you should check if the ray hits the wall, not just if it hits something, otherwise people inside could be blocked by say, another player, if they were looking at it at an angle. |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2016 02:55 AM |
local ray = Ray.new(player.Character:FindFirstChild('Torso').Position, script.Parent:FindFirstChild('LockDoor').Position) local hit = game.workspace:FindPartOnRayWithIgnoreList(ray, {player.Character}) if (hit and hit.Name == 'LockDoor') then local lockmodel = sp:WaitForChild('Lock') if not sp.Opened.Value and not sp.IsOpening.Value and not sp.Locked.Value then sp.Locked.Value = true lockmodel.Locked.Transparency = 0 lockmodel.Unlocked.Transparency = 1 lockfx:Play() elseif not sp.Opened.Value and not sp.IsOpening.Value and sp.Locked.Value then sp.Locked.Value = false lockmodel.Locked.Transparency = 1 lockmodel.Unlocked.Transparency = 0 unlockfx:Play() end end
I currently have this as my code, I don't know what to do from here so it ignores Players. |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2016 01:49 PM |
| You've got a few options I can see, one option is put every players character into the ignore list, another option is cast the ray, see what it hits, if it isn't a while add it to the ignore list and recast the ray and repeat until it hits a wall or hits the button |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2016 01:51 PM |
| Correct me if I'm wrong but couldn't you just put another wall between the wall and the button, the camera won't clip through two parts right? |
|
|
| Report Abuse |
|
|
qqtt991
|
  |
| Joined: 14 Dec 2007 |
| Total Posts: 1387 |
|
| |
|
|
| 27 Oct 2016 03:02 PM |
| WorldToScreenPoint will return a position and a bool; if the bool is false, don't open it. Simple. |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2016 03:10 PM |
I don't see how WorldToScreenPoint would help, the button would be on screen because the camera would be through the wall.
|
|
|
| Report Abuse |
|
|
|
| 27 Oct 2016 03:11 PM |
| Ah. That was my bad, nevermind. |
|
|
| Report Abuse |
|
|