admin管理员组

文章数量:1122832

so im trying to make a little casino game on roblox for fun and for whatever reason it refuses to find anything inside of the folder where you place your bet in the machine

here's the script (the print functions are temporary and it will not print "Found betplacer")

local p = game.Players.LocalPlayer

function canBet()
    return true--p:FindFirstChild("CanBet").Value
end

function bet(event:RemoteEvent, racer:Instance, tokens:number)
    if canBet() then
        event:FireServer(tokens, racer)
    end
end

for _, machine in pairs(workspace.Machines:GetChildren()) do
    if machine.Name == "RacingHeads" then
        local placers = machine.Placers:GetChildren()

        print("Found RacingHeads")

        for _, v in pairs(placers) do
            local event = v.Parent.Parent:FindFirstChild("Bet")
            local racer = v:FindFirstChild("Racer").Value
            local gui = v:FindFirstChild("BetGui")
            local button:TextButton = gui.Submit
            local function quickbet()
                local tokens = tonumber(gui.Amount.Text)

                print("Bet on RacingHeads")
                bet(event, racer, tokens)
            end

            print("Found betplacer")

            button.MouseButton1Click:Connect(quickbet)
            button.TouchTap:Connect(quickbet)
        end
    end
end

so im trying to make a little casino game on roblox for fun and for whatever reason it refuses to find anything inside of the folder where you place your bet in the machine

here's the script (the print functions are temporary and it will not print "Found betplacer")

local p = game.Players.LocalPlayer

function canBet()
    return true--p:FindFirstChild("CanBet").Value
end

function bet(event:RemoteEvent, racer:Instance, tokens:number)
    if canBet() then
        event:FireServer(tokens, racer)
    end
end

for _, machine in pairs(workspace.Machines:GetChildren()) do
    if machine.Name == "RacingHeads" then
        local placers = machine.Placers:GetChildren()

        print("Found RacingHeads")

        for _, v in pairs(placers) do
            local event = v.Parent.Parent:FindFirstChild("Bet")
            local racer = v:FindFirstChild("Racer").Value
            local gui = v:FindFirstChild("BetGui")
            local button:TextButton = gui.Submit
            local function quickbet()
                local tokens = tonumber(gui.Amount.Text)

                print("Bet on RacingHeads")
                bet(event, racer, tokens)
            end

            print("Found betplacer")

            button.MouseButton1Click:Connect(quickbet)
            button.TouchTap:Connect(quickbet)
        end
    end
end
Share Improve this question asked Nov 21, 2024 at 23:58 spispi 33 bronze badges 1
  • 1 Please check out this guide: minimal reproducible example. Roblox questions can be hard to create MREs for, but some good guidelines are to start by focusing heavily on the "minimal" part (what is the absolute simplest example you can create that still produces a similar problem), then provide thorough details as to how to reproduce the problem - the code of course, but also any objects that should go in the workspace and how they should be organized. – Anerdw Commented Nov 22, 2024 at 1:16
Add a comment  | 

1 Answer 1

Reset to default 0

this is likely because of Streaming Enabled. A simple fix would be to disable it. It's a property of workspace

本文标签: luaGetChildren() seemingly returning an empty tableStack Overflow