Okay so. Im not getting a error or something like that. Here is the case that i want to implement a feature into my already existing system and dont even know how to start with it.
So basically, in my game there are keycards that are just tools. And now i got the following problem: Roblox hit detection is kinda weird. For example: I holy my keycard into the detector part and it sometimes counts my character as the part thats touching it, sometimes the keycard and sometimes my avatars accessories. Is there any way in the script to filter it, so it only accepts it if really the keycard is hitting it and ignores everything else? Cause sometimes i stick in the keycard and nothing happens because i have no filter in my script that can detect if its now something else touching or a keycard.
I need to be able to see your code to help.
thats the point. I have none. I dont know where to start in that matter. All i do have is the code thats supposed to be executed and the code that chekcs if the part that touched the detector was one of the allowed keycards
You can check the name of the object. Or have some kind of value attached to it just in case. Then use an if statement
if Object.Name = “KeyCard” then
– Open the door
else
— Its not the KeyCard
end
alright, try this as a script inside of the detector:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("KeyCard") then
--script for opening
end
end)
i may have been a bit unclear and you all didnt seem to get it, which is understandable, but i now found the solution for myself. Sorry for bothering you