I have made kill color doors where you pick a color to walk through for obby


so i have made these doors and when you walk through one color it will kill you if you pick the right color then it wont kill you what im having the issue with is that when a player touches the frame of either color doors it kills them what can i do to stop the frame itself killing players

like there is no kill scrips in the frame itself at all i dont understand that if its just one part that has the script to kill which is the door why is the frames killing when touched?

this is the script script.Parent.Touched:connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild(“Humanoid”) then
hit.Parent.Humanoid.Health = 0
end
end) for the kill player

That’s weird. Even though I’m not an expert, I don’t see anything wrong with the script. Try some of these things though:

  1. Print the name of parts that were touched, both hit and script.Parent. Then check if the part that touched was really the door, and ensure that player’s parts hit the door correctly.
  2. Speaking of which, check if the script is placed in the door and not the frame. Maybe the actual door is named “frame” and the frame “door”.
  3. Check if that scripts works on other parts.
  4. Make sure that parts don’t clip through each other.


so i have moved both sides thats suppost to be the kill parts and i tested it and sadly when i touched the frame it still kills me so what happens if i was to turn the can touch off on the frames? will it do anything

instead of using the script i used could i use one from like a lava jump and test it

You can try setting the CanCollide property of the frame parts to false to prevent players from colliding with them. This will stop players from being killed when touching the frame, but still allow them to interact with the doors.

Here’s an example of how you can set the CanCollide property for the frame parts:

for i, part in pairs(workspace.Frame:GetChildren()) do
    part.CanCollide = false
end

This code will loop through all the children of the Frame object and set their CanCollide property to false , preventing players from colliding with them.

well what i did was take a kill script from one of my other models which was for the checkerboard kinda and this is what the script i used to test with function onTouched(hit)
local human = hit.Parent:FindFirstChild(“Humanoid”)

if (human ~= nil) then 
	human.Health = 0 
end

end

if (script.Parent ~= nil) and (script.Parent.className == “Part”) then
connection = script.Parent.Touched:connect(onTouched)
end
so far when i touch the black frame it does not kill me so idk why the other one did

So you found a solution to your problem? The issue may have been caused by the fact that the script was attached to the frame, rather than just the door itself. When you touch the frame, it triggers the “Touched” event and therefore, the “onTouched” function would run and cause you to be killed. By attaching the script only to the door, you ensure that the “Touched” event is only triggered when the door is touched and not the frame.

ill try that too and see what happens but if one part is set to kill when touched and theres parts that dont carry the script i would think that each part thats around it should not be killing since its a soild part

Oh gotcha, If one part is set to kill when touched, and the other parts don’t have the kill script, then those parts should not be killing the player when touched. However, it’s possible that the script is being run on the frame parts because they are children of the part that has the kill script. In that case, the script would apply to the whole object and not just the part with the kill script. To avoid this, you could create separate parts for the frame and make sure that the kill script is only applied to the door part, not to the frame

yea i some what found the issue but imma keep testing incase it breaks which ill just re build it and see whats up

i think i overlooked it when i made it
thanks for the help trying to trouble shoot me