Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Properties Script Thing?

Asked by
Jiptix 2
9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

Okay I am editing this script for a tycoon thing. I think I have the BrickColor area correct, but the problem is at the Material section(I think?. If someone could tell me what is wrong, I would appreciate it!

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

while true do
    wait(1.5) -- How long in between drops
    local part = Instance.new("Part",workspace.PartStorage)
    part.BrickColor = BrickColor.Bronze
    part.Material = Material.Marble
    local cash = Instance.new("IntValue",part)
    cash.Name = "Cash"
    cash.Value = 5 -- How much the drops are worth
    part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.4,0)
    part.FormFactor = "Custom"
    part.Size=Vector3.new(1.2, 1.2, 1.2) -- Size of the drops
    part.TopSurface = "Smooth"
    part.BottomSurface = "Smooth"
    game.Debris:AddItem(part,20) -- How long until the drops expire
end

Thanks, Jiptix

2 answers

Log in to vote
2
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

To be most technically correct, you should be using Enums when you're setting something that in Studio is a drop-down list:

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

while true do
    wait(1.5) -- How long in between drops
    local part = Instance.new("Part",workspace.PartStorage)
    part.BrickColor = BrickColor.new("Bronze")
    part.Material = Enum.Material.Marble
    local cash = Instance.new("IntValue",part)
    cash.Name = "Cash"
    cash.Value = 5 -- How much the drops are worth
    part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.4,0)
    part.FormFactor = Enum.FormFactor.Custom
    part.Size=Vector3.new(1.2, 1.2, 1.2) -- Size of the drops
    part.TopSurface = Enum.SurfaceType.Smooth
    part.BottomSurface = Enum.SurfaceType.Smooth
    game.Debris:AddItem(part,20) -- How long until the drops expire
end

Note that part.BrickColor = BrickColor.new("Bronze") is not an Enum, it is a BrickColor constructor.

Ad
Log in to vote
0
Answered by 9 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.

part.BrickColor = BrickColor.new("Bronze")

part.Material = "Marble"

What this does is it says part.Material = "The color but in a string" With the color, it gets a new BrickColor("String name of the color")

0
Sorry about the script being formatting as text, I don't know how to fix :( UnknownGenerations 10 — 9y
0
Ok thanks let me try it. Jiptix 2 — 9y
0
Still not working. Jiptix 2 — 9y
0
To get the script into the script form, click on the blue circle that says Lua. It should bring up 2 lines like this: ~~~~~~~~~~ and put the code in the middle of the lines (should be a gap between the lines) NinjoOnline 1146 — 9y

Answer this question