Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I'm trying to make it so when these two parts collide one goes to a specified location it wont work?

local block = game.Workspace.Block

block.Touched:Connect(function(hit)

print(hit.name)

if game.Workspace.voidHolder.Void(hit) then
	
block.Position = Vector3.new(-18.65, 1.66, -33.105)

end

end)

That's my code but it keeps giving me this error

08:48:25.486 - Trying to call method on object of type: Part with incorrect arguments.

2 answers

You have some typo in your script:

First one:

print(hit.name)

It should be hit.Name, because Lua is case-sensitive :/

Second one:

if game.Workspace.voidHolder.Void(hit) then

I think you mean if hit, I guess. Because you want to find is hit exist or not.

Hope this helped :D

local block = game.Workspace.Block
-- defines block
block.Touched:Connect(function(hit)
	print(hit.Name)
	-- prints hit's name
	if hit == game.Workspace.voidHolder.Void then
		-- if hit is the void then
		block.Position = Vector3.new(-18.65, 1.66, -33.105)
end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.