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

How can I make a model spawner tool?

Hello , for my game I really need to make a tool that when clicked , spawns a Model right next to the player (regardless of where the player is on the map , it spawns right next to them). How would I go about doing this? Thank you

1 comment

0

You could use the Activated event of a Tool to detect when a player clicks, and use MoveTo to have the model move to a position.

2 answers

✓ Accepted answer

If you have the tool, the decal, everything, and you just need the script, you can do the following: You will need a normal script. Put it at the tool. You can type

--Also, I am not scripting you the events when the player clicks with the tool, etc..
plr = script.Parent.Parent.Parent -- script is in the Tool, tool is in Backpack, backpack is in the player (at game.Players.Player)
isplayer = workspace:FindFirstChild(plr.Name)
if isplayer ~= nil then --Making sure the player's model is in the workspace
	isplr = isplayer:FindFirstChild("Humanoid")
	if isplr ~= nil then -- If 'Humanoid' exist:
		--And there, you can get player's position with the following code:
		pos = isplr.Torso.Position --isplr.Torso.CFrame is also can be used
		--And now you just spawn the model at a little bit away from the player. I am not going to script that for you.
	end
end

I hope I didn't made any mistakes, I didn't tested it because I can't script a tool, but I think that it works. You got the player's position, you can now do anything. I hope this is what you wanted.

4 comments

0

wow too many comments dude your script is hard to read

0

Appreciate the help , thank you:)

0

Enzo341 You are welcome!

0

and MCAndRobloxUnited just remove the comments, I am just trying to make him understand this, next time I write less comments :D

you can use Clone() and MoveTo() to accomplise this local Model = game:GetService("ServerStorage")

local WorkspaceModel = Model:Clone()
WorkspaceModel.Parent = workspace
WorkspaceMode:MoveTo(game.Players.Enzo341.Character.HumanoidRootPart.Position + Vector3.new(0,0,-5))

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