Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

(Repeat) Why does the Model Placer work only in Studio Mode not Player Mode?

Yes, I did try to turn the Hopper Bin into a tool and turn off its required handle, but still don't work! Please Help!

I am making a new game called "Clash of Roblox 2" and I want to make it where you buy a model "Barracks Level 1" and you get the tool from a tool collector one time only... I got that part covered, but I am testing the Barracks placer where you click somewhere and it places a Barracks, but on Studio Mode it runs smoothly and on Player Mode on the actual game it does not! Why?! What I Did! 1. In Starter Pack 2. Hopper Bin Tool 3. Inside Hopper Bin Tool is a Spawner Script and then a Figure Model 4. Inside the Figure Model is the "Barracks" 5. Studio Mode it Places 6. Player Mode it doesn't! Spawner Script

bin = script.Parent

function onButton1Down(mouse)

	local model = bin.Figure:clone() --- "Figure" = Name of model

	model.Parent = game.Workspace
	model:MakeJoints()
	model:MoveTo(mouse.hit.p)
	script.Parent:Remove()

end

function onSelected(mouse)
	mouse.Icon = "rbxasset://textures\\GunCursor.png"
	mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end

bin.Selected:connect(onSelected)

1 answer

A few things:

  • ROBLOX is case-sensitive. This means you need to be extra careful about making sure you get the proper capitalization of things, otherwise it could break your entire script. In this case, you forgot to capitalize the C in :Clone().

  • Although it will not break your script, it is recommended that you use the Destroy() function instead of the Remove() function to remove stuff. The Remove function has been deprecated by ROBLOX, which means that it is not guaranteed to work.

If this answer helped you, please up vote and/or accept it.

This discussion is preserved as it was. New answers, comments, and votes are closed.