Touched event does not work for spawnpoints

I have been trying to disable spawnpoints when they collide with a part. For some reason it is not working. Any help would be appreciated

script.Parent.Touched:Connect(function(hit)
	if hit:IsA("SpawnLocation") then
		hit.Enabled = false
		print("destroyedspawn")
	end
end)

It’s a server script placed inside the SpawnLocation instance right?

local SpawnLocation = workspace:WaitForChild("SpawnLocation")

SpawnLocation.Touched:Connect(function(hit)
	if hit.Name == ("SomePart") then
		SpawnLocation.Enabled = false
		print(SpawnLocation.Enabled)
	end
end)

I changed it slightly and checked if a part touching the SpawnLocation was a specific part, it worked when testing.

This also works if the script is placed inside the SpawnLocation instance itself:

script.Parent.Touched:Connect(function(hit)
	if hit.Name == ("SomePart") then
		script.Parent.Enabled = false
		print(script.Parent.Enabled)
	end
end)

The issue is that the spawnpoints have to be unanchored for some odd reason

That wasn’t the case for me, the above code worked in studio when testing with the SpawnLocation instances being anchored.

1 Like

Probably because I made the part which was to collide with the spawn points uncollidable. That could be a reason

oh well if you want to play the game: super powered ultra flinging ridiculous ball - Roblox