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
1 Answer
Reset to default 0this 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
版权声明:本文标题:lua - :GetChildren() seemingly returning an empty table? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736306447a1932961.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论