Why wont it understand a simple touch event?

So, this block of code used to work, but now it does not, and i have no idea why. Urgent help needed.

	if part.Name == "Ball" then
		print("Blue scored a goal")
		game.ReplicatedStorage.BlueGoals.Value = game.ReplicatedStorage.BlueGoals.Value + 1
		Ball.Position = originalPosition
	    Ball.Anchored = true
		Ball.Anchored = false

Any help is appreciated! :slight_smile:

What happened originally. and what happens now? I’m assuming it no longer prints. Are you sure .touched is even being called. Did you change any properties of the “Ball” part

It is nothing to do with the reaction code, as “Blue Scored” isn’t even in the output. It must be something to do with .Touched being called. I have also checked that the parts still have the correct names.

Did you use local or serverscript? Any errors in the output?

serverscript, and no output errors.

i havent changed it so i am really not sure what has happened.

Are there any other scripts interferring with it? For example one that changes the name of the ball?

Nope, cant find any. It all worked like three hours ago.

This is probably the part where the code is stuck, as the event is declared correctly and between the event and the print is only the check for the string.

yep. I am extremely puzzled… i have no clue what to do

Check for the name of the ball, because that’s gotta be the part where it’s stuck.

As much as i would like to say you are correct, nope.

Add a print every line and see how far it comes.

uh try that
can’t test it.
tried my best

local Goal1 = game.Workspace:WaitForChild("goal1")
local BlueGoals = game.ReplicatedStorage:WaitForChild("BlueGoals")

      if hit.Name == "Ball" then
    print("Blue scored a goal")
    BlueGoals.Value = BlueGoals.Value + 1
        hit.Position = originalPosition
          hit.Anchored = true
           hit.Anchored = false

1 Like

Thats what i am currently doing.

It doesnt understand that i touched it, so its not to do with the ball.

Yeah if problem is fixed.

Don’t forget to solve!

If didn’t work. tell me

oof…. it doesn’t work. I’ll try it again tommorrow and if it doesn’t work then, I’ll create this as a completely new game, but if it doesn’t work, thanks for the help still! :slight_smile:

Nothing wrong with the script, It might be the name of the goal or the ball. Double check the names of the ball and goal and make sure it is “goal1” and “Ball1”, script is case sensitive so be careful of that

exactly what I did. I literally have no clue on what is happening, so I am redoing every script in the game. oof.