E.g If I have a model in the games Lighting called "cheese", Player clicks the button--->"cheese" gets moved from the Lighting to, lets say... (1,1,2) on the map. Then if player clicks another button--->"cheese" gets moved from workspace, back into the lighting.
For the benefit of possible script wizards who may answer this who haven't answered previous question(s) of mine: I'm not very experienced at all in making scripts from scratch on ROBLOX, I only know some of the basic terminology (but even then, I don't know which terminology are really deemed as "basic" so you can see my struggle here.)
I've tried various methods to create this but they've mostly resulted in the model that I want moving being deleted entirely (le cri.)
Help would be very much appreciated and I'll be sure to credit you properly if you can help me find a working solution. :)
This should work, I used serverstorage instead of lighting, it's better to use serverstorage now. Put this script under the brick you want to be clicked to change the parent of the map.
local serverstorage = game:GetService("ServerStorage") -- serverstorage is the service to store whatever you want in, Lighting was used before ServerStorage was made local model = serverstorage:WaitForChild("cheese") -- replace "cheese" with the name of the model under serverstorage local brick = script.Parent -- variable for the parent of the script, which is what the clickdetector is going to be under local detector = Instance.new("ClickDetector", brick) -- creating a clickdetector, which is used to be able to click a specific part, and parenting it to the script's parent. local isinwork = false -- creating debounce for later usage --[[You have to already have the model positioned as you want it to be shown as, in serverstorage, when it's parented to workspace it will be shown in the position you had it at when u stored the model in serverstorage]]-- function moveModel() -- function that will be called when someone clicks the part if not isinwork then -- checking if the debounce is false, if it is then it will parent it to workspace model.Parent = game.Workspace isinwork = true -- here it is setting the debounce to true so when it's clicked again it is parented to serverstorage else -- if the debounce is true then it will parent it to serverstorage model.Parent = serverstorage isinwork = false -- here it is setting the debounce to false so when it's clicked again it is parented to workspace end end detector.MouseClick:connect(moveModel) -- calling the function when the brick has been clicked
Hope that helped!
First of all Use Replicated storage, so with that said here's the code, Put it inside a gui text button, or image button. Here's the code:
function onButtonClicked() local Model = game.ReplicatedStorage.ClassicSword:Clone() -- replace classicsword with your item to clone Model.Parent = workspace Model.Position = (Vector3.new(-104, 0.5, -3)) --change to positoon you want end script.Parent.MouseButton1Down:connect(onButtonClicked)