generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Rayvast-Type ClickDetector

Previous Thread :: Next Thread 
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
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
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
26 Oct 2016 10:51 PM
bump
Report Abuse
pidgey is not online. 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
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
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 is not online. 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
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
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 is not online. pidgey
Joined: 16 Jan 2008
Total Posts: 2739
26 Oct 2016 11:50 PM
i.imgur
/iEA1DYP

something like this?
Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
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
NarutoUzmakiAkatsuki is not online. NarutoUzmakiAkatsuki
Joined: 11 Jan 2013
Total Posts: 267
27 Oct 2016 12:18 AM
Make the wall really thick
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
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
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
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
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
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
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
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
RoyStanford is online. RoyStanford
Joined: 21 Oct 2008
Total Posts: 2222
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 is online. qqtt991
Joined: 14 Dec 2007
Total Posts: 1387
27 Oct 2016 02:13 PM
Just double up the walls.


Report Abuse
lua_pointer is not online. lua_pointer
Joined: 15 Oct 2016
Total Posts: 179
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
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
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
lua_pointer is not online. lua_pointer
Joined: 15 Oct 2016
Total Posts: 179
27 Oct 2016 03:11 PM
Ah. That was my bad, nevermind.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image