ROBLOX[Lua]大亨-我如何改变我的机器创建的对象类型



嗨,stackoverflow社区!我目前正在ROBLOX开发我自己的"大亨"游戏。然而,我在脚本方面遇到了一个小问题。。所以基本上,当玩家购买一台名为"Dropper"的机器时,"Dropper"会创建灰色立方体。我遇到的问题是,我希望灰色的立方体变成灰绿色的霓虹灯球体。我试过多种方法来修复它,但我还没有弄清楚。这是"Dropper"机器的脚本:

wait(2)
workspace:WaitForChild("PartStorage")

deb = true 
script.Parent.Clicker.ClickDetector.MouseClick:connect(function(wat)
if deb == true then
deb = false
local part = Instance.new("Part",workspace.PartStorage)
part.BrickColor=script.Parent.Parent.Parent.DropColor.Value
part.Material=script.Parent.Parent.Parent.MaterialValue.Value
local cash = Instance.new("IntValue",part)
cash.Name = "Cash"
cash.Value = 1 -- How much the drops are worth
part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.3,0)
part.FormFactor = "Custom"
part.Size=Vector3.new(1, 1, 1) -- Size of the drops
part.TopSurface = "Smooth"
part.BottomSurface = "Smooth"
game.Debris:AddItem(part,20) -- How long until the drops expire
wait(.15)
deb = true
end
end)

为了澄清,我希望脚本生成一个石灰绿色的霓虹灯球体,而不是当前的灰色块。如有任何帮助,我们将不胜感激!

提前感谢,E.W

Discord服务器中的某个人帮我解决了这个问题!这就是解决方案:

wait(2)
workspace:WaitForChild("PartStorage")
deb = true 
script.Parent.Clicker.ClickDetector.MouseClick:connect(function(wat)
if deb == true then
deb = false
local part = Instance.new("Part",workspace.PartStorage)
part.Shape = Enum.PartType.Ball
part.BrickColor=BrickColor.new("Lime green")
part.Material=script.Parent.Parent.Parent.MaterialValue.Value
local cash = Instance.new("IntValue",part)
cash.Name = "Cash"
cash.Value = 1 -- How much the drops are worth
part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.3,0)
part.FormFactor = "Custom"
part.Size=Vector3.new(1, 1, 1) -- Size of the drops
part.TopSurface = "Smooth"
part.BottomSurface = "Smooth"
game.Debris:AddItem(part,20) -- How long until the drops expire
wait(.15)
deb = true
end
end)

最新更新