How do you make a brick that changes the bool value and exchanges for money script?
I am making a game similar to cook burgers but more like work at a pizza place and I have tried to make a script that changes the color of a brick, changes the bool value, and if the bool value is true deletes the part and exchanges it for money. The color works fine, but the bool value changer and money brick don't work. Here is the bool value changer script:
1 | script.Parent.Touched:Connect( function (hit) |
2 | local Cooked = hit.Parent:FindFirstChild( "Cooked" ) |
Here is the script that is meant to exchange the brick for money:
01 | function onTouched(hit) |
02 | if hit.Parent:FindFirstChild( "MeatPatty" ) then |
04 | local Cooked = hit.Parent |
05 | if cooked.value = = true then |
06 | leaderstats.Money = money + cash |
10 | script.Parent.Touched:Connect(onTouched) |
If anyone could tell me what I'm doing wrong and help me change it, it would be very appreciated. Ciao!