Will we ever see a better TouchEnded event?

Well, if they revamp TouchEnded() then they should also revamp Touched()

1 Like

I did a quick thing that should fix the issue,

End result / how to set up:
76769219f1e09692edb6cc1b90245a23

The script in the “Touch” block;

--example script
script.Parent.Touched:Connect(function(hit)
	local human = hit.Parent:FindFirstChild("Humanoid")
	if human ~= nil then
		local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
			if game.Workspace.components.IsDisabled.Value == false then 
			print('Roblox is the best! I like to code')
                   wait(.2)
                     game.Workspace.components.IsTouched.Value = true 
game.Workspace.components.IsTouched.Value = false 
script.Disabled = true
wait(.1)
				end
	end
	end)

The “controller” script;

while true do
	local disabled = game.Workspace.components.IsDisabled
	local touched = game.Workspace.components.IsTouched
	if disabled == true then
		         wait(4) --the time you want it to take for the player to be able to touch the brick again
		local scripto = game.Workspace.components.touch.Script
		         scripto.Disabled = false
		wait(.2)
		disabled.Value = false
		touched.Value = false
	else
		if touched.Value == true then 
			disabled.Value = true 
			print('disabled')
		end
	end
end
while true do
	local disabled = game.Workspace.components.IsDisabled
	local touched = game.Workspace.components.IsTouched
	if touched.Value == true then
		disabled.Value = true
		print('disabled?')
	end
end

Requirements:

  1. Have a folder named “components”

  2. Have the scripts I showed set up properly like in the image

  3. Have 2 BoolValues , one named “IsTouched”, other named “IsDisabled”

That’s pretty much all! But you can make this WAY more advanced if you wanted to, this is just the liquefied version ( meaning simpler to understand ).

This just comes to show, there is solutions to everything!

2 Likes

You don’t need boolvalues, you can just make a bool variable in the script itself.

Also you should try to avoid enabling / disabling scripts.

4 Likes