Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

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

Asked by 5 days 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:

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

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

function onTouched(hit)
    if hit.Parent:FindFirstChild("MeatPatty") then
        local cash = 50
        local Cooked = hit.Parent
        if cooked.value == true then
            leaderstats.Money = money + cash
        end


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!

Answer this question