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

Dropper Script Doesnt Work?

Asked by 9 years ago

--Please help becuase i tried to make a script and i failed. please help me!

wait (2) local p = Instance.new("Part") p.Size = Vector3.new(1, 1, 1)--Size p.BrickColor = BrickColor.new("Mid gray") local cash = Instance.new("IntValue",part) cash.Name = "Cash" p.Position = script.Parent.Position p.Parent = game.Workspace p.Material = "Plastic" p.Reflectance = 0.0 p.Transparency = 0.0 p.Shape = "Block" wait(2) end end

0
Help us first by Code blocking your code so we can see it properly. Click the Lua icon (It's blue) and paste your code in-between the squiggly lines "~~~~" that appear. alphawolvess 1784 — 9y

2 answers

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
9 years ago

Alright, this isn't very complex so I'll go ahead and put it in a code block for you;

wait (2)
local p = Instance.new("Part")
p.Size = Vector3.new(1, 1, 1)--Size 
p.BrickColor = BrickColor.new("Mid gray")
local cash = Instance.new("IntValue",part)
cash.Name = "Cash" 
p.Position = script.Parent.Position 
p.Parent = game.Workspace
p.Material = "Plastic"
p.Reflectance = 0.0
p.Transparency = 0.0 
p.Shape = "Block"
wait(2) 
end 
end

So first, before we even get to the errors, lets shorten this a bit. When you create a new Part, their properties are set to certain defaults. Material is, by default, set to Plastic. Reflectance and Transparency are both set to 0. Shape is set to Block. Therefore we can remove these lines to get;

wait (2)
local p = Instance.new("Part")
p.Size = Vector3.new(1, 1, 1)--Size 
p.BrickColor = BrickColor.new("Mid gray")
local cash = Instance.new("IntValue",part)
cash.Name = "Cash" 
p.Position = script.Parent.Position 
p.Parent = game.Workspace
wait(2) 
end 
end

The first and most obvious error is your two ends at the bottom. You only need to add an end when you create a new scope (with the exception of repeat loops). Here you do not create a new scope, so we can get rid of the ends.

wait (2)
local p = Instance.new("Part")
p.Size = Vector3.new(1, 1, 1)--Size 
p.BrickColor = BrickColor.new("Mid gray")
local cash = Instance.new("IntValue",part)
cash.Name = "Cash" 
p.Position = script.Parent.Position 
p.Parent = game.Workspace
wait(2) 

Although it must be noted that putting a wait() function at the end of your code is pointless, since nothing happens after it. We can also take out p.Parent = game.Workspace and just use the second argument of Instance.new() to set the parent.

wait (2)
local p = Instance.new("Part", game.Workspace)
p.Size = Vector3.new(1, 1, 1)--Size 
p.BrickColor = BrickColor.new("Mid gray")
local cash = Instance.new("IntValue",part)
cash.Name = "Cash" 
p.Position = script.Parent.Position 

But look on line 5! There is no value named part! That will definitely cause an error. We used p for the Part variable, so we must use it consistently.

wait (2)
local p = Instance.new("Part", game.Workspace)
p.Size = Vector3.new(1, 1, 1)--Size 
p.BrickColor = BrickColor.new("Mid gray")
local cash = Instance.new("IntValue", p)
cash.Name = "Cash" 
p.Position = script.Parent.Position 

And we might as well rearrange the Part editing with the Cash editing just for organization purposes.

wait (2)
local p = Instance.new("Part", game.Workspace)
p.Size = Vector3.new(1, 1, 1)--Size 
p.BrickColor = BrickColor.new("Mid gray")
p.Position = script.Parent.Position 

local cash = Instance.new("IntValue", p)
cash.Name = "Cash" 

Now you have a functioning dropper! But wait, this will only run once. We need to use a while loop, so it will run forever. We will make the while loop's condition just the word true, because the word true will never equal false. Therefore the loop will run forever. This time we will be creating a new scope, so don't forget an end. Also remember to indent!

while true do
    wait (2)
    local p = Instance.new("Part", game.Workspace)
    p.Size = Vector3.new(1, 1, 1)--Size 
    p.BrickColor = BrickColor.new("Mid gray")
    p.Position = script.Parent.Position 

    local cash = Instance.new("IntValue", p)
    cash.Name = "Cash"
end
0
Thanks! iiZexyii 0 — 9y
0
NO I FIGURED IT OUT NOOBS i tried all of your scripts. didnt work so i tried it again but changed it and it worked. wow iiZexyii 0 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

--this is the real script -.-

while true do

wait (2)

local p = Instance.new("Part", game.Workspace)

p.Size = Vector3.new(1, 1, 1)--Size

p.BrickColor = BrickColor.new("Mid gray")

p.Position = script.Parent.Position



local cash = Instance.new("IntValue", p)

cash.Name = "Cash"
cash.Value = 1

end

Answer this question