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

How to spawn house via button from lighting?

Asked by 7 years ago
Edited 7 years ago

Looking for how i can do this. Couldn't find any where else with an answer.

The button is in work space. The house is in lighting. How do i press the button to make the house appear in work space?

2 answers

Log in to vote
0
Answered by 7 years ago

I would not suggest using Lighting as the service to use for spawning parts, it is easily configurable by just moving your house to replicatedstorage, and instead of game.Lighting, do game.ReplicatedStorage, however, for your question, just add a clickdetector onto the button and do the following.

local Detect = script.parent.ClickDetector

Detect.MouseClick:connect(function()
    game.Lighting.House.Clone().Parent = game.Workspace
end)

--Note to use a server script instead of local,

0
Wouldn't it be game.Lighting.House:Clone().Parent - game.Workspace? GlidingPlane 28 — 7y
0
I tested it straight up in studio, how do you expect to get the House from lighting, move it into workspace by subtracting? Just curious. Dev_Unreal 136 — 7y
0
It's not spawning the house from lighting... Do i put that script into a brick with a click detector? QuantumScripter 48 — 7y
0
If you are still having trouble,, sorry about the LATE reply, but please be more clear as to your issue, and I'll walk you through it. Dev_Unreal 136 — 7y
0
It wasn't working at first using your script but then i changed ".clone" to ":clone" and it worked. But the house falls apart when it spawns. QuantumScripter 48 — 7y
Ad
Log in to vote
0
Answered by
GingeyLol 338 Moderation Voter
7 years ago
local thing = script.Parent.ClickDetector
local house = game.Lighting:FindFirstChild("House")

thing.MouseClick:connect(function(aaaaaa)
    house.Parent = game.Workspace
end)
0
It spawns the house but it falls apart.. QuantumScripter 48 — 7y
0
anchor the house GingeyLol 338 — 7y
0
I can't find out how to anchor the house because it's made up of many parts grouped together. QuantumScripter 48 — 7y
0
Also, i can't anchor the house because i need to be able to destroy it with a rocket launcher. QuantumScripter 48 — 7y
View all comments (4 more)
0
house.Anchored = true. the rocket launcher can still destroy the house. GingeyLol 338 — 7y
0
Hey. The house still falls apart when it spawns. QuantumScripter 48 — 7y
0
Did you anchor it? it shouldn't fall apart when it spawns. GingeyLol 338 — 7y
0
Yes i did. QuantumScripter 48 — 6y

Answer this question