Part Touch Connect

  1. What do you want to achieve? If player touched the part, the text changes.

  2. What is the issue? IT do nothing.

  3. What solutions have you tried so far? Yes, but no solutions.

local Text = script.Parent.Part2.SurfaceGui.TextLabel.TextTransparency
local Touch = script.Parent.Part
local character = script.Parent.Parent
local humanoid = character:WaitForChild("Humanoid")

Touch.Touched:Connect(function(hit)
	if hit.Parent.Parent:FindFirstChild("Humanoid") then
		Text = 0
		wait(0.5)
		Text = 1
		wait(0.5)
		Text = 0
		wait(0.5)
		Text = 1
		wait(0.5)
		Text = 0
		wait(2.5)
		Text = 1
	end
end)
1 Like

Any solutions? Please help me. :smiley:

you need to index the property you want to change, otherwise you are changing the value of the Text variable instead of the property value

also you can use loop statements to repeat patterns

local Text = script.Parent.Part2.SurfaceGui.TextLabel
local Touch = script.Parent.Part
local Character = script.Parent.Parent

Touch.Touched:Connect(function(Hit)
	local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
	if Humanoid then
		for i = 1, 3 do
			Text.TextTransparency = 0
			task.wait(0.5)
			Text.TextTransparency = 1
		end
	end
end)
1 Like
local Text = script.Parent.Part2.SurfaceGui.TextLabel
local Touch = script.Parent

Touch.Touched:Connect(function(hit)
	if hit.Parent.Parent:FindFirstChild("Humanoid") then
		print("working")
		Text.TextTransparency = 0
		wait(0.5)
		Text.TextTransparency = 1
		wait(0.5)
		Text.TextTransparency = 0
		wait(0.5)
		Text.TextTransparency = 1
		wait(0.5)
		Text.TextTransparency = 0
		wait(2.5)
		Text.TextTransparency = 1
	end
end)

Try using @V_ladzec he got a better script and good performance

1 Like

That information helps me. Thanks.

Thank you too. It helps me a lot.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.