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

Script Doesnt Check Children And Bring Tool From ReplicatedStorage To Workspace?

Asked by 1 year ago

im making a script that, theres a prox prompt, once you activate it while holding an item, that item gets bring into workspace and removes the item, once all of them are in workspace, the script brings a tool from replicated storage and parents it to workspace, removes the original model with the items, adds a point to a task menu (shared for all players) enables a new prox point and disabled the original prox point, it was working before, but for some reason it stopped working and is now broken, can anyone help?

local tomato = nil
local choco = nil
local ham = nil
local orange = nil

script.Parent.Triggered:Connect(function(plr)
    if plr.Character:FindFirstChild("Tomato Soup") then
        game:GetService("ReplicatedStorage").Ingreds["Tomato Soup"].Parent = workspace.Cooking.Pot
        plr.Character:FindFirstChild("Tomato Soup").Parent = nil
        tomato = true
    end
    if plr.Character:FindFirstChild("Orange") then
        game:GetService("ReplicatedStorage").Ingreds["Oranges"].Parent = workspace.Cooking.Pot
        plr.Character:FindFirstChild("Orange").Parent = nil
        orange = true
    end
    if plr.Character:FindFirstChild("Ham") then
        game:GetService("ReplicatedStorage").Ingreds["Ham"].Parent = workspace.Cooking.Pot
        plr.Character:FindFirstChild("Ham").Parent = nil
        ham = true
    end
    if plr.Character:FindFirstChild("Chocolate") then
        game:GetService("ReplicatedStorage").Ingreds["Chocolate"].Parent = workspace.Cooking.Pot
        plr.Character:FindFirstChild("Chocolate").Parent = nil
        choco = true
    end
end)

local player = game:GetService("Players").LocalPlayer
local playergui = player.PlayerGui


    while tomato == true and choco == true and ham == true and orange == true do
            script.Parent.Enabled = false
        game:GetService("ReplicatedStorage")["Full Pot"].Parent = workspace.Cooking
            workspace.Cooking.POTinoven.ProximityPrompt.Enabled = true
            playergui.Tasks.Frame.cook.Value.Value += 1
        script.Parent.Parent.Parent:Destroy()
    end

Answer this question