Can you not use two functions?

So I wanted to make a script which, when you touch a certain part it will Give you a message,
and since I wanted to make multiple of them, I decided to make it easier to do that,
but the function only works once and never again, I wanna know why does that happen,
and how to fix it.

Please help, thank you.

2 Likes

You can define a function and bind it to multiple events:

local function touch(Humanoid)
print(Humanoid)
	if Humanoid.Name == "HumanoidRootPart" then
		Humanoid.Anchored = true
		Humanoid.Velocity = Vector3.new(0,0,0)
		local player = game.Players:FindFirstChild(Humanoid.Parent.Name)
		game.ReplicatedStorage.Event:FireClient(player, "Text")
	end
end

script.Parent.Tutorial1.Part.Touched:Connect(touch)
script.Parent.Tutorial2.Part.Touched:Connect(touch)

Still don’t work, It’s pretty much the same.

What part is it in? Show a picture if you can please!

Could you link me a game/model of the parts, and the gui so I could investigate further? If not it is okay.

what does that mean? is the video not enough?

The video only shows that it does not work. I need more than that to figure it out. @Sir_Pixelated

so… what exactly do you need?

I need a picture/video of the whole workspace, or a uncopylocked version of the game.

But why do you need that? How does having a pic of the workspace help?

Your video is not embedded properly, so we have to download it. For my safety, I won’t download it.

Anyways, what Blokav posted works. I don’t know how it will not work unless you disabled the script. Further information is needed.

Its needed because where your script is, what kind it is, and making sure your accessing the right part is all potential problems. Let alone faulty gui code.

Not embedded properly? How Do I do that?

The wmv format can only be played on Windows and is not embedded.
I recommend using mp4 format.

1 Like
local remote = game:GetService("ReplicatedStorage"):WaitForChild("CamZoom")
remote.OnClientEvent:Connect(function(Say)
	print("Fired")
	game.Players.LocalPlayer.CameraMaxZoomDistance = 0.5
	local TextLabel = script.Parent
	TextLabel.Visible = true
	for length = 1, string.len(Say) do
		TextLabel.Text = string.sub(Say,1,length)
		script.Click:Play()
		wait(0.1)
	end
	wait(1)
	TextLabel.Visible = false
	game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored = false
	game.Players.LocalPlayer.CameraMaxZoomDistance = 30
end)

this is the script that show the GUI.
Does this help?

Never mind, I figured it out :slight_smile: