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

How do i change what is dropped in a tycoon shape wise from the dropper? *Scripts inside*

Asked by
mj21mm 0
9 years ago

I have the basics of tycooning and i understand how to make round balls drop from the dropper. But i am not experienced enough to know how to do this, so would someone help me by chance? MY question is how do i change the dropper to drop say a block rather than a sphere, and then when it hits the upgrade it takes the shape of the sword. Here are the scripts i am using for the ball drop and i want it to drop blocks instead:

reload = 4

wait(1)

while true do
p = Instance.new("Part")
p.Position = script.Parent.Position
p.Size = Vector3.new(1,1,1)
p.Name = "ABrick"
p.BrickColor = BrickColor.new("Bright red")
p.TopSurface = ("Smooth")
p.BottomSurface = ("Smooth")
p.Parent = script.Parent.Parent.Parent
p.Shape = 0
wait(reload)
end

Heres the upgrade script im using to make the ball shiner but i want it to take a shape of a normal sword:

pcall(script.Parent.Touched:connect(function(hit)
if hit.Parent ~= nil then
if hit.Name == "ABrick2" then
hit.Name = "ABrick3"
hit.Reflectance = .15
hit.Transparency = 0
end
end
end))

If anyone can help me i would greatly appreciate it.

1
CODE BLOCKS. They exist. Use them. Marios2 360 — 9y
0
And if anyone can help with input i would greatly appreciate it. mj21mm 0 — 9y

2 answers

Log in to vote
0
Answered by
Marios2 360 Moderation Voter
9 years ago

Although this is clearly free-modeled, i will do your thing. Along with enhancing the first script, i took the sword's mesh and texture and put it in the second.

Dropper

wait(1)
while wait(4) do --Every 4 seconds do the following
p = Instance.new("Part", script.Parent.Parent.Parent) --Instance.new has a second "property" to set the parent directly from there
p.Position = script.Parent.Position
p.Size = Vector3.new(1,1,1)
p.Name = "ABrick"
p.BrickColor = BrickColor.new("Bright red")
p.TopSurface = ("Smooth")
p.BottomSurface = ("Smooth")
p.Shape = 0
end

Upgrader #2 (Transmorpher)

script.Parent.Touched:connect(function(hit) --pcall is completely useless here
if hit.Parent ~= nil then
if hit.Name == "ABrick2" then
hit.Name = "ABrick3"
local mesh = Instance.new("SpecialMesh", hit) --I recreate the sword mesh here
mesh.MeshId = "rbxasset://fonts/sword.mesh"
mesh.TextureId = "rbxasset://textures/SwordTexture.png"
mesh.MeshType = "FileMesh"
end
end
end)


Ad
Log in to vote
0
Answered by 9 years ago

Ok, this is actually really simple. If you insert a sword into your game, there will be a mesh inside of the sword's handle. With that in mind, add this code to the upgrade script:

local mesh = Instance.new('SpecialMesh', hit)
mesh.MeshId = "rbxasset://fonts/sword.mesh"

The same applies for all meshes. So, if you want it to look like a gun, simple replace the mesh id with the mesh id of the gun. Final code:

pcall(script.Parent.Touched:connect(function(hit)
    if hit.Parent ~= nil then
        if hit.Name == "ABrick2" then
            hit.Name = "ABrick3"
            hit.Reflectance = .15
            hit.Transparency = 0
            local mesh = Instance.new('SpecialMesh', hit)
            mesh.MeshType = 'FileMesh'
            mesh.MeshId = "rbxasset://fonts/sword.mesh"
            --[[If you want the sword texture, add this: 
            mesh.TextureId = "rbxasset://textures/SwordTexture.png"
            --]]
        end
    end
end))

If this doesn't work I probably made a typo.

Answer this question