【发布时间】:2022-12-11 10:21:22
【问题描述】:
脚本不工作
我对脚本编写非常陌生,我只是在 ROBLOX 工作室闲逛,我制作了一个脚本,旨在将存储在 ReplicatedStorage 中的项目放入特定播放器 StarterPack,但无论我如何更改它都不想工作。 谁能解释为什么?
local playerName = "plr name"
local toolName = "tool name"
game.Players.PlayerAdded:Connect(function(player)
if player.Name == playerName then
local tool = game.ReplicatedStorage:FindFirstChild(toolName)
player.StarterPack:AddItem(tool)
end
end)
【问题讨论】:
-
嘿嘿,当你问问题的时候,仅仅说某件事不起作用是不够的。你需要解释你期望发生什么,以及实际发生了什么。你的代码在执行吗?您的代码是否向“输出”窗口抛出错误?这是脚本还是本地脚本?它位于哪里?