【问题标题】:ROBLOX [Lua] Tycoon - How do I change the type of object my machine creates?ROBLOX [Lua] Tycoon - 如何更改我的机器创建的对象类型?
【发布时间】:2019-01-10 15:12:57
【问题描述】:

嘿 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

【问题讨论】:

    标签: object colors lua scripting


    【解决方案1】:

    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)
    

    【讨论】:

      猜你喜欢
      • 2017-06-15
      • 1970-01-01
      • 2021-08-27
      • 2017-06-26
      • 1970-01-01
      • 2020-06-23
      • 2021-08-14
      • 1970-01-01
      • 2023-03-21
      相关资源
      最近更新 更多