I just don't realize why this is not working... i have a part and i have another part with this script but it seems to not work...
script.Parent.Touched:connect(function(ThisPart) -- first part if ThisPart.Parent.Name == "Item" then print("Part touch another part") else print(ThisPart.Parent.Name) end end)
But it always prints the players name
It keeps printing the players name for only 1 reason. You're putting "ThisPart.Parent.Name". The parameter of this function gives you the part that touched the part. The parent of ThisPart is the actual player. ThisPart's parent would be the player. Get rid of the parent when printing when you printed.
The actual solution if someone stumbles across this trash:
parts gotta be unanchored or you gotta use gettouchingparts or you can use this trashy code i made:
local GetTouched = {} local function GetTouchingParts(part,func) print('checked') local connection = part.Touched:Connect(function() end) local results = part:GetTouchingParts() connection:Disconnect() return results end local TouchedList = {} TouchedList.__index = TouchedList function GetTouched.new(part,func) print('set') local returned = setmetatable(GetTouched,TouchedList) part:GetPropertyChangedSignal("Position"):Connect(function() if #GetTouchingParts(part) == 0 then else returned = GetTouchingParts(part) TouchedList[part] = returned end end) part:GetPropertyChangedSignal("Size"):Connect(function() if #GetTouchingParts(part) == 0 then else returned = GetTouchingParts(part) TouchedList[part] = returned end end) local meta = setmetatable(TouchedList,{ __index = GetTouched, __newindex = function(a,b,c) func() end }) end GetTouched.new(script.Parent, function() print('hello') end)