帮助我的孩子学会发展。使用Roblox作为工具。
我们在ServerScriptService文件夹中,在一个名为OverheadRankScript的文件中。我有一行这样的代码:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DataModule = require(ReplicatedStorage:WaitForChild("DataModule"))
我的ModuleScript在ReplicatedStorage文件夹中,它是新的,如下所示。
local mod
local claim = script.Parent.Parent.Parent.Parent.StandMesh.Claim
这将触发Proximty提示符。
claim.Triggered:Connect(function(player)
local screengui = player.PlayerGui:WaitForChild('Popups')
local popup = player.PlayerGui:WaitForChild('Popups').ClaimedBooth
local bool = player:WaitForChild
下面的代码在驱动器座椅内部的脚本中&当播放机坐到座位上时,它会发出以下输出
“'Workspace.Car4.DriveSeat:WaitForChild("Humanoid")”上无限可能的产量
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
function onSeated(isSeated,Seat)
if humanoid ~= nil then
local p = game.Players:Find
我得到了这个无限收益:在'Players.Aiman123boss.PlayerGui:WaitForChild("Main")‘上无限收益 我想修复它,所以这是我的脚本: local pg = player:WaitForChild("PlayerGui")
local Main = pg:WaitForChild("Main")
for i, v in pairs(Main.PetShop.ScrollingFrame:GetChildren()) do
if v.Name ~= "Template" and
<---This is my current local script--->
local replicatedStorage = game:GetService("ReplicatedStorage")
local starterRebirthAmount = 5000
local player = game.Players.LocalPlayer
local mainFrame = script.Parent:WaitForChild("MainFrame")
local rebirthMenu = mainFrame:WaitForChil
我想做一些像扔长矛那样的事情,我很困惑。上面写着:
ServerScriptService.FireMagic.FireSpear:16:尝试用“位置”索引零
无论如何,下面是LocalScript代码:
wait(1)
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Mouse = Player:GetMouse()
local rp = game:GetService("ReplicatedStorage")
local FireSpear = rp:
当我的排行榜试图更新时,我得到了这个错误。502: API服务拒绝了请求,但出现错误。排序的数据存储区类型的值格式无效。参数名称:值这是脚本: local CoinsDS = game:GetService("DataStoreService"):GetOrderedDataStore("MoneyLeaderboard")
local suffixes = {'','K','M','B','T','qd','Qn','sx',
local myhuman = script.Parent:WaitForChild("Humanoid")
local myroot = script.Parent:WaitForChild("HumanoidRootPart")
local head = script.Parent:WaitForChild("Head")
local grab = script.Parent:WaitForChild("Grab")
local grabanim = myhuman:LoadAnimation(grab)
grabanim.P
我让这个工具等待"PlaceEvent",但是我一直收到这个错误:
21:58:52.024 - Infinite yield possible on 'ReplicatedStorage:WaitForChild("PlaceEvent")'
21:58:52.026 - Stack Begin
21:58:52.026 - Script 'Players.rohanskywalker.Backpack.Grass.Main', Line 7
21:58:52.026 - Stack End
下面是脚本:
-- Local Sc
所以,我想让玩家在我的游戏中成功地捐赠,一个GUi会出现在玩家屏幕上,上面写着购买完成
当我测试它时,当我试图测试购买捐赠时,它会显示一个GUi,但是,实际结果已经显示在输出中了。当我尝试测试它时,输出中出现了一个错误ServerScriptService.Purchases:14: attempt to index nil with 'WaitForChild'。
我已经在谷歌上搜索过了,但还是无法理解。
下面是代码:
-- Products for purchases
local Donate1ProductID = 1296480045
local Donate2Prod
这就是我要用的剧本。从这段YouTube视频中得到的:
。
我已经多次检查和尝试解决这个问题,找不到我的错误。
Roblox:
local RP = game:GetService("ReplicatedStorage")
local Combat = RP:WaitForChild("Combat")
local Animations = script:WaitForChild("Animations")
local anims =
(
Animations:WaitForChild("Right
script.Parent.MouseButton1Click:connect(function()
local RS = game:GetService("ReplicatedStorage")
local item = RS:WaitForChild("Pencil")
local price = 350
local player = game.Players.LocalPlayer
local stats = player:WaitForChild("leaderstats")
i
我目前正在为ROBLOX制作一个游戏,这是一个充满激情的项目,但我遇到了一个问题。 我正在制作一个脚本,这样当播放器运行时,相机的视场将会上升,表现得就像你真的很快。 我已经成功地编写了代码,但是当在studio或客户端中运行时,它会冻结游戏,并在输出中显示“脚本超时:耗尽允许的执行时间”。 有没有办法解决这个问题?非常感谢! 代码如下: local TweenService = game:GetService("TweenService")
local player = game.Players.LocalPlayer
local Humanoid = script.Par
正如你在下面的图片中看到的,当我进入圈子时,我不能卖我背包里的东西。我收到这个错误/警告,但我不知道问题出在哪里。我发现这个问题发生在第5行:player:WaitForChild
第5行的错误/警告:Players.asbjornbonde.PlayerGui:WaitForChild("Stats")上可能存在无限收益
图片如下:
下面是我的代码:
script.Parent.Touched:connect(function(Hit)
local player = game.Players:FindFirstChild(Hit.Parent.Name)
所以,如果购买完成了,我想做一个GUI
我没有得到它的工作,但没有错误信息
下面是代码:
剧本:
-- Products for purchases
local Donate1ProductID = 1296480045
local Donate2ProductID = 1296484976
local Donate3ProductID = 1296484935
local Donate4ProductID = 1296484932
local Donate5ProductID = 1296483595
local Donate6ProductID = 1296484931
local Do
嗨,我正在制作一个塔防御游戏和塔楼攻击的动画不断循环。这是代码:(不是整个代码)
function Tower.Attack(newTower)
local target = FindNearestTarget(newTower)
if target then
animateTowerEvent:FireAllClients(newTower, "Attack")
target.Humanoid:TakeDamage(40)
end
task.wait(1)
Tower.Attack(newTower)
end
以下是动画脚本:
local Replicat
问题是,我制造了一个战斗系统,第56行的情况是:敌人人道:伤害(伤害),错误说: ServerScriptService.CombatSystem:56:尝试用'TakeDamage‘索引零,我不知道该怎么做(这也是整个代码)。
local rp = game:GetService("ReplicatedStorage")
local Combat = rp:WaitForChild("Combat")
local Debris = game:GetService("Debris")
local Animations = script
我在罗布洛工作室,当我为我的游戏制作动画时,我得到了这个,它包括一个人形,我正在尝试动画。有两个动画,第一个工作,但另一个,我没有得到这个错误。当我放置类人动画时,动画不会启动,但是第一个动画应该按预期开始,但是当类人攻击发生时,另一个动画就应该启动。请帮帮我,我会感激一切的
(代码)
local function setAnimation(object, animName)
local humanoid = object:WaitForChild("Humanoid")
local animationsFolder = object:WaitForChild("A
我试图更改以在客户端获取side的值,但它以零的形式返回,有人能帮上忙吗?
剧本:
script.Parent.MouseClick:Connect(function(plr)
if plr.Team == game.Teams.Mastermind then
local zombiespawn = script.Parent.Parent
game.ReplicatedStorage.Events:WaitForChild("Onzombiespawnclick"):FireAllClients(plr,script.Parent.Parent.CFrame
我正在TextButton脚本中创建一个脚本,该脚本将检查TextBox是否在表中包含任何单词或字符串。
text = script.Parent.Parent:WaitForChild('TextBox')
label = script.Parent.Parent:WaitForChild('TextLabel')
a = {'test1','test2','test3'}
script.Parent.MouseButton1Click:connect(function()
if string.m
这个脚本应该在点击树的时候给人们10块木头。但它不起作用,也没有错误。我认为local wood = player:WaitForChild("leaderstats"):WaitForChild("Wood")线是问题所在
local clickDetector = workspace.Tree.ClickDetector
local player = game.Players.LocalPlayer
local wood = player:WaitForChild("leaderstats"):WaitForChild("Wood
我被设定了密码,但他不工作。代码基本上是让虚拟人跟随玩家,但类人不跟随角色。这是密码。
function followplayer()
local closestplayer, closestdistance = nil, 200
local dummy = workspace.Follow.Dummy
for i, player in pairs(workspace:GetChildren()) do
if player:FindFirstChild("Humanoid") ~= dummy then
closestdistance = (player
我试着用Roblox制作一个脚本,这样如果你在20根钉外,然后按E键,它就会弹出一个NPC对话框。它正在LocalScript中运行。现在,我只让它在您按E键时显示一条消息,但是它不会显示该消息。
local HumanoidRootPart = game.Players.LocalPlayer:WaitForChild("HumanoidRootPart")
local UserInputService = game:GetService("UserInputService")
local part = game.workspace.TableBox.Tabl
我一直在试图把一个npc移到一个方向点上,它工作了一会儿,但后来它开始不正常了,而且开始表现得很奇怪。
航路点:
移动脚本:
for i,node in pairs(script.Parent.Parent.Parent.Cartnodes:GetChildren()) do
if node:IsA("BasePart") then
print(node.Name)
script.Parent.Parent:WaitForChild("Rafthuman"):MoveTo(node.Position)
script.Pa
所以基本上,我做了一种武器,它在你击中人们之后向他们投掷,但它只在NPC上起作用,而不是在玩家身上。有人能给我解释一下为什么吗?
local power = 5
local function fling(character)
local humanoid = character:FindFirstChildOfClass("Humanoid")
local rootpart
if humanoid then
humanoid:ChangeState(11)
rootpart = humanoid.RootPart
我一直在尝试将ModuleScript连接到服务器脚本,结果抛出了错误:Workspace.Script:6: attempt to call field 'check3' (a nil value) ModuleScript local GunStats = {}
local part = workspace:WaitForChild('Mosin'):WaitForChild("Union")
local billboard = workspace:WaitForChild('BillboardPart'):WaitForC
因此,当工具(L1)配备完毕时,我会尝试这样做,这时会出现一个接近提示,但我的当前脚本不起作用。下面是:
local Prompt = script.Parent
local Event = game.ReplicatedStorage:WaitForChild("Events"):WaitForChild("HeavyDoor"):WaitForChild("RemoteEvent")
local Player = game.Players.LocalPlayer
Prompt.Enabled = false
local function
所以我制作了一个脚本,每分钟给你5块现金,我还为剧本做了一个游戏通行证,如果有人拥有游戏通行证,他们会得到双倍的钱,作为非游戏通行证持有者。这是我的脚本,我没有任何脚本给现金,但问题是在第二个脚本块,控制台打印一个错误:
亲水相09:10:57.466 ServerScriptService.CashGiver:6: attempt to index nil with 'UserId' - Server - CashGiver:6
local Give5Cash = game.ReplicatedStorage:WaitForChild("Give5Cash
我正在尝试为我的游戏制作一个情节选择系统。我想让绘图选择系统GUI在我单击play按钮后在屏幕上进行补间。然而,我的脚本一次又一次地给出“尝试调用TweenInfo值”。下面是完整的代码。 local TweenService = game:GetService("TweenService")
local player = game.Players.LocalPlayer
local Camera = game.Workspace.Camera
local PlotSelect = script.Parent:WaitForChild("PlotSelect
我已经检查了代码多次,但找不到任何会导致这一点的东西。我是不是太盲目了?如果是这样的话,你能告诉我正确的方向吗? 下面是我的代码: local rp = game:GetService("UserInputService")
local remote = rp:WaitForChild("Earthquake")
local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")
local Meshes
我在一个类似的问题中找到了这个脚本,但是,我得到了错误16:11:18.560 - Workspace.Script:2: attempt to index nil with 'Character'
local Player = game:GetService("Players").LocalPlayer
local character = Player.Character or Player.CharacterAdded:Wait()
local HumanoidRootPart = character:WaitForChild("HumanoidRo
我正在做一个塔防御游戏,只是在我的健康脚本中出现了attempt to index nil with 'WaitForChild'错误。塔是看着敌人,播放动画,它只是没有显示更新的僵尸的健康。所讨论的代码是local humanoid = model:WaitForChild("Humanoid"),有人知道如何使它显示最新的健康状况吗?
我正在尝试在Roblox上做一个游戏,不久前我遇到了一个错误,我找不到修复方法,于是放弃了,然后我又开始尝试修复它。当我尝试检查玩家是否有能力购买该物品时,我得到的错误值不是玩家的有效成员,以下是错误的来源代码 game:GetService("ReplicatedStorage"):WaitForChild("Shop"):WaitForChild("UpgradeClicks").OnServerEvent:Connect(function(player, price)
if player.leaderstats.Views.Val
我试着从Vector3切换到CFrame,但它仍然不起作用。我得到的最好的部分是在空中看起来像10个壮举,这就是我到目前为止所拥有的。 local Dog = game:GetService("ReplicatedStorage"):WaitForChild("PetTesting")
local RunService = game:GetService("RunService")
local tweenService = game:GetService("TweenService")
local Petfollow =
我正在编写一个脚本,它应该找到目标播放器,如果播放器内部的值为真,那么就是MoveTo()。它输出一个错误,指出Attempt to index nil with 'WaitForChild',这是一个服务器脚本,错误在plr:WaitForChild("Crime",1)。这就是它: local crime= false
local plr = nil
function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
loc
我在我的游戏中有一个系统,当一个玩家踩上检查点时,领导板中的Stage值会上升,然后这个值被保存到该玩家的userId中。
我希望有一个button,它将值重置为0,这是我尝试过的代码。
local textButton = script.Parent
local Players = game:GetService("Players")
textButton.MouseButton1Up:Connect(function()
local player = game.Players.LocalPlayer
local
Workspace.Part.Script:16:尝试索引本地“screengui”(一个零值)
wait(2) -- Testing to make sure assets loaded
script.Parent.Touched:connect(function(hit)
if not hit or not hit.Parent then return end
local human = hit.Parent:findFirstChild("Humanoid")
if human and human:IsA("Humanoid")
我正在和我的朋友一起玩游戏,我们让一个物体在房子周围移动,然后去随机点。问题是,如果它在X轴上向上移动,然后向下移动,它就会开始摇晃,行为怪异。
path:ComputeAsync(character.Position, workspace:WaitForChild("ModelsMain").SleepBag.SLEEP.Position)
waypoints = path:GetWaypoints()
for _, wp in pairs(waypoints) do
local tweenInfo =
所以有两个脚本: script和localscript。 该脚本确定将有多少秒,然后将其触发到所有播放器客户端& localscript将文本更改为秒。但是当我测试这个游戏时,countdow冻结在一个数字或一个随机数字上,不管怎样,这是脚本: 脚本: local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("IntermissonEvent")
local secondsRe
我已经写了几个不同的脚本,但我似乎不能正确理解它。基本上我有一个商店,玩家可以在那里购买工具和物品,但每次我测试它并购买工具,在我死后,工具就消失了。我不希望人们不得不一次又一次地购买。
这是他们购买工具的脚本,以及工具的去向。
script.Parent.MouseButton1Click:connect(function()
local RS = game:GetService('ReplicatedStorage')
local item = RS:WaitForChild('GravityCoil')
local price = 0
local play