part.Touched:Connect(function()) not working

image
it sure is

Maybe CanTouch is set to false, I don’t know if CanCollide effects this, try changing it.

CanTouch is on and cancollide does not affect it

What I meant is
Don’t parent the script to ColSphere
Parent it to StarterCharacterScripts

Kwvee_BOICharacter isn’t the real character but it’s the one you use to play so by using starter character scripts i will not be accessing Kwvee_BOICharacter… which i need to access to get ColSphere

you could try doing basepart:getpartsinpart()

You will be accessing it
the script will be parented to it

image
here’s an examlpe of what i mean (game is running), because of the way the character system is set up in my game this doesn’t work.

how would i go about doing that?

How do you load the characters then?

Now this could be 100% wrong because i am unable to access studio but im pretty sure you can do

local part = workspace.Part
local parts = Game:getPartsInPart(part)
#parts.changed:connect(function()
--what you are trying to do when something is in the part or touching it.

end)

it’s complicated and i didn’t make the system

gave that a try too but couldn’t get it to work

what do you mean, like you didnt understand it well enough or it just didnt work?

i understand i think, it just didn’t work.

1 Like

I’m noticing in the image above that it is a server sided script is that true?

Maybe a script like this should work, which detects if the obj is not nil.

local part = script.Parent

part.Touched:Connect(function(obj)
	if obj ~= nil then
		print(obj.Name)
		return obj
	end
end)

this is server sided by the way. Also I saw a green bubble in the first photo, so make sure thats not interfering with you touching the part.

I think it needs to be a LocalScript if it’s in StarterCharacterScripts.

Is the script enabled after it gets reparented?
It shouldn’t run in replicated storage, so shouldn’t initialise with the wrong parent, but just to cross this possibility off the list.

So then something like this would probably work, right?

local humanoid = script.Parent:WaitForChild("Humanoid")

humanoid.Touched:Connect(function(obj)
	if obj ~= nil then
		print(obj.Name)
		return obj
	end
end)

We are talking about it being in StarterCharacterScripts here. As the script is cloned into the character, we will try and find the humanoid in the current character and then see if it is touched by anything not nil.