#Help with Brick Spawner

1 messages · Page 1 of 1 (latest)

ebon shoal
#

Heyo New Coder Here. I'm working on a small idea for a game and I need a spawner that spawns a brick on top of another one wherever it may have been moved to. I have been able to get the code to spawn a new brick at 0,0,0 but I cant seem to get it to spawn on an already existing one I have named "Cube". If anyone can help me that would be very much appreciated as I have watched well over 20 videos by now and sourced all of the Roblox forum pages and found nothing to help. Thanks in advanced!

''' lau
local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
end)
local input = Enum.KeyCode
if input == Enum.KeyCode.E then
local Cube = game.Workspace:FindFirstChild("Cube")
if not Cube then
print ("Cube was not found")
return
end
end

-- Create the Brick
local brick = Instance.new("Part")
brick.Size = Vector3.new(4, 1, 4)
brick.BrickColor = BrickColor.new("Really red")

--Spawn on Cube
local Cube = game.Workspace:FindFirstChild("Cube")
brick.Position = Cube.Position + Vector3.new(0, 2, 0)
brick.Parent = game.Workspace

''''

frosty breachBOT
#

studio** You are now Level 1! **studio

lunar olive
ebon shoal
#

local currently

lunar olive
#

You're either trying to read input from the server, or create parts from the client, either of which won't work

#

I mean, you can create parts on the client, but they won't be replicated to the server

ebon shoal
#

so if I swap it to a normal script it would work or do I need to edit it?

#

sorry still new to this im confused

lunar olive
#

-# Sidenote that this is very exploit prone, but since you're new I don't think it matters much

ebon shoal
#

okay I think I get it

#

yea its just a game for me to learn but i think i have an idea

#

so would those be different scripts that call on each other or can I cram that into one?

lunar olive
ebon shoal
#

ah okay awesome thank you so much

#

I can work with this thanks a million!