Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you make a brick that changes the bool value and exchanges for money script?

Asked by 4 years ago

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:

1script.Parent.Touched:Connect(function(hit)
2    local Cooked = hit.Parent:FindFirstChild("Cooked")
3    Cooked.Value = true
4end)

Here is the script that is meant to exchange the brick for money:

01function onTouched(hit)
02    if hit.Parent:FindFirstChild("MeatPatty") then
03        local cash = 50
04        local Cooked = hit.Parent
05        if cooked.value == true then
06            leaderstats.Money = money + cash
07        end
08 
09 
10script.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!

Answer this question