#How to make Buttons work without .Touched

1 messages · Page 1 of 1 (latest)

rotund rock
#

Im making a button simulator, but i dont want to use .Touched because its not as good, and it also kinda hurts to mash the keyboard whenever the player is pushing buttons, so i wanted to use raycasting but that isnt working and also i dont know how i would use it.

verbal sundial
#

getpartboundsinbox?

rotund rock
#

what does that do?

queen flower
#

Raycasting is also a good method to solve your problem, as well, so I would continue to experiment with that

finite mica
#

use collectionservice

rotund rock
#

whats that

finite mica
#

so you only need 1 .Touched event

#

its a service that lets you get all the objects with the same tag

queen flower
#

CollectionService could work as well, yeah

#

Would be trickier to implement than just using a raycast, in my opinion, though

rotund rock
#

Im using raycast, but i cant get it to work

#

like

#

it doesnt print any result

#

i tried rotating it every way possible

timid vale
rotund rock
#

because .touched only works when the player is moving on the part

#

and i can fire raycast every set ammount of time

timid vale
#

skill issue

queen flower
#

real

#

Definitely is doable with .Touched

#

Just slightly harder

rotund rock
#

i forgot how to check for the hrp without all this code

#

it keeps printing RayCast Had No Result

timid vale
timid vale
rotund rock
#

shid i need to do that for EVERY button?

#

thats gonna be laggy as hell

timid vale
#

you misread

#

from the character is cheapest option but its still really dumb

rotund rock
#

Ohhh

#

mb

#

i might be dyslexic

timid vale
#

did you maybe consider putting a big invisible hitbox on top of the button where the player would be standing, instead of connecting to the button's surface which will periodically fire when moving?

queen flower
rotund rock
queen flower
rotund rock
#

i tried every single thing

#

directiong

timid vale
#

how can you manage a raycast but not know how to connect to .touched+.touchended and filter for hrp's?

queen flower
rotund rock
#

i know

queen flower
#

Also, there's no need for the raycast part

queen flower
#

Just use the humanoidrootparts position as an origin with a raycast direction of Vector3.new(0, -4, 0)

timid vale
rotund rock
#

al?

#

wait i got it

#

au

#

no

#

a1

#

uh

queen flower
rotund rock
#

whats an overlap parameter

timid vale
#

na jk ai doesnt write code this bad

#

ai is stupid with code, but not bad with it.

fair sundial
#

so you want to make a button

#

that neees ro be touched

#

but you don't want touched?

timid vale
fair sundial
#

the ultrashit?

rotund rock
#

i want it so the player doesnt have to move

queen flower
rotund rock
#

YO

#

wait

#

how do i set a filter so it doesnt detect the legs?

fair sundial
#

wait a sec why shouldn't you use .Touched for this

#

or anything related to contact

rotund rock
#

not every time the player collides with it

fair sundial
#

so

#

a specific amount of lresses allowed?

queen flower
#

oh wait, I mistook overlap params for raycast params

fair sundial
#

Overlap is for sparial query

queen flower
#

I just get the words mixed up 😔

#

too similar

queen flower
queen flower
# rotund rock i want it so the player doesnt have to move

Btw, here's a snippet of code I whipped up in like 10 seconds that you can use to see how the raycast params work

 local character = script.Parent

local humRp = character.HumanoidRootPart

while task.wait() do
    local rp = RaycastParams.new()
    rp.FilterDescendantsInstances = character:GetChildren()
    
    local ray = workspace:Raycast(humRp.Position, Vector3.new(0, -4, 0), rp)
    if ray then
        print(ray.Instance, ray.Position)
    end
    
end
fair sundial
#

waitbso you want to just check if the legs are touching

#

thats it?

rotund rock
#

YIPEE

#

i did it 😄

#

ty guys

fair sundial
#

im still confused on waht ur trying to do

#

but uhh ggs ig