Can somebody tell me what's wrong with my coin giver script?

Hello, I’m a beginner in scripting, and I can’t figure out why my coin-giver script isn’t working:

The script function is to give the user coins when I touch/step on the block. Any help is appreciated :slight_smile:

1 Like

Hey, greetings!
There seems to be missing a end at line 22.
To be more clear, add a end between these lines:

coins.Value - coins.Value + 1;

AND

end

IT MIGHT LOOK LIKE

local coinGiver = game.Workspace.CoinGiver;
coinGiver.Touched:Connect(function(otherpart)
  local humanoid = otherpart.Parent:FindFirstChild("Humanoid");
  if humanoid then
    coins.Value = coins.Value + 1;
  end
end

Also, be sure to not add the while loop here, as it isn’t necessary and will make you experience unplayable.
Tell me if you need any more help! :slight_smile:

1 Like

image
First: Check screenshot
Second: It’s not a good idea to put the loop here

1 Like

Ohhh i understand now, thank youuuuuuuuuuuuu!!

2 Likes

The script works now, TYSM!!!

1 Like

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