TouchedEvent Not working (Not Solved)

Could Someone help me? I was Making a Build System for my Plot System But There is a Problem with that You can Place Blocks Into each other Please Help, I tried Making touched event but its not working. Any help is appreciated

    Mouse.Move:Connect(function()

	if Placing == true then
		local RayCastResult = workspace:Raycast(Mouse.Hit.Position + Vector3.new(0,150,0),Vector3.new(0,-250,0))
		if RayCastResult ~= nil then 
	
			if RayCastResult.Instance.Name == "PlotSpace" and RayCastResult.Instance.Parent:WaitForChild("PlayerOwns").Value == Player.Name  then 
				
				PlotSystemBuildPart.Position = RayCastResult.Instance.Position + Vector3.new(0,PlotSystemBuildPart.Size.Y,0)

				
			end
		end
	end
	
	PlotSystemBuildPart.Touched:Connect(function(Hit) -- Touched Event Here
		
		if Hit.Name == MaterialSeedsFolder:FindFirstChild(Hit.Name).Name then
			
			PlotSystemBuildPart.Color = Color3.new(1, 0.2, 0.2)

		else
			PlotSystemBuildPart.Color =  MaterialSeedsFolder:WaitForChild(CarrotTool.Name).Color
		end
	end)
end)
2 Likes

The Touched event is on line 48. Please someone Help!

Mind boggled, I have to read this in the morning!

PlotSystemBuildPart.Size.Y/1

eh?

I’m talking about the Touched Event And yes I know that I removed it from like 5 minutes ago in Studio.
If You know why then Please tell me

I will have a read in the morning, but there was quite a bit of convolution there! I will help if I can, but I can’t now. It’s too late here in the UK and just looking at that has already made me start to chew!

Alright, thanks for your help!

Can you give us the whole script?

I didn’t really help, I will chew if it still stands as unsolved tomorrow.

local Player = game.Players.LocalPlayer

local CarrotTool = script.Parent
local Mouse = Player:GetMouse()

local Placing = false

local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local MaterialSeedsFolder = ReplicatedStorage:WaitForChild(“Seeds”)
local RemoteEvents = ReplicatedStorage:WaitForChild(“RemoteEvents”)

local PlotSystemBuildPart = MaterialSeedsFolder:WaitForChild(CarrotTool.Name):Clone()
PlotSystemBuildPart.Parent = nil
PlotSystemBuildPart.Anchored = true
PlotSystemBuildPart.CanCollide = false
PlotSystemBuildPart.Transparency = .4

CarrotTool.Equipped:Connect(function()

PlotSystemBuildPart.Parent = game.Workspace
Placing = true

end)

CarrotTool.Unequipped:Connect(function()

PlotSystemBuildPart.Parent = nil
Placing = false

end)

Mouse.Move:Connect(function()

if Placing == true then
	local RayCastResult = workspace:Raycast(Mouse.Hit.Position + Vector3.new(0,150,0),Vector3.new(0,-250,0))
	if RayCastResult ~= nil then 

		if RayCastResult.Instance.Name == "PlotSpace" and RayCastResult.Instance.Parent:WaitForChild("PlayerOwns").Value == Player.Name  then 

			PlotSystemBuildPart.Position = RayCastResult.Instance.Position + Vector3.new(0,PlotSystemBuildPart.Size.Y/1,0)


		end
	end
end

end)

CarrotTool.Activated:Connect(function()

RemoteEvents.PlacingEvent:FireServer(CarrotTool, PlotSystemBuildPart.Position)

end)

That’s the Whole Script (Its a local script inside of a tool)
What I’m basically trying to do is Make the blocks Can’t touch other parts except “PlotSpace” or else it will destroy if it touches

How about part’s property?
not Anchored: moved from the intended location
And not Collidable: fallen into the void

not Touchable: you know…

There is a Property inside it Called CanTouch
Also I have to make it anchored and Collision off Because I’m making a farming game where you Place seeds and this is basically where you will place it , I don’t know what to do I’m lost

If you have any solution Please tell me…

And CanTouch on?

No words from developer console?

Yes CanTouch is on and No Words From dev console

I found the root of the issue. Should set to the inside of workspace or serverstorage

No, I made it like that Because the Player won’t see it if its Unequipped
You can see when its equipped placing will be equal to true

I don’t know what to do :frowning:
Should I just create a new topic about the same thing? Because not many people are helping

Can you read the script? You don’t seem to understand what do I mean?

Try this:

if PlotSystemBuildPart then
PlotSystemBuildPart.Touched:Connect(function(Hit) -- Touched Event Here
		
		if Hit.Name == MaterialSeedsFolder:FindFirstChild(Hit.Name).Name then
			
			PlotSystemBuildPart.Color = Color3.new(1, 0.2, 0.2)

		else
			PlotSystemBuildPart.Color =  MaterialSeedsFolder:WaitForChild(CarrotTool.Name).Color
		end
	end)
end

Alright thanks ill test it out and see if it works

Sorry I’m on mobile right now :grinning:. Maybe I’ll test it later