[SOLVED] How to make a script where when you say a certain thing it spawns in a model at your character?

Hi, so I’m trying to make a script of where you say like :spawn plane it spawns a plane at your character and only a certain rank can use this. How do I do this?

This is scripting support, not “how to”.

How do you think you would do it?

You need to think off how to use on chatted events, get group rank, and :Clone().Parent = game.Players.Cookie_DevX.Character.HumanoidRootPart.Position

And then add some offsett to the position.

I’m just new, this is only my first year of scripting and I don’t know how to make that many things.

Should I put the model in replicated storage?

Well let’s think, replicated storage can be accessed by server and local script, so that would probably be a good start, yes.

If your new, learning more “how to script”, rather than “how to make things” will have a much larger benefit.

Sorry, I just wanna try making this and then I’ll stop harassing you.

Here is my first lines of code:

Local groupId = 12760887
Local rank = 255
Local Model = game.ReplicatedStorage.Model
If string.sub(msg,1,10) == “:spawn plane” and
player:GetRankInGroup(groupId) = rank then
Model.Cframe = (player.Character.HumanoidRootPart)

Woah woah woah, you’re not harassing me.

I understand your new & you probably haven’t used scripting support before.

Don’t worry about asking questions.

I can loose my patience at some times.

But that’s because normally I have a lot of people bombarding at me.

Now, let’s try to get through this together.

So, let’s move on.

Is your Model anchored?

Yes. Is that good or bad?

I understand that about you having to do other things as well,


  • Always format your code.

  • Variables should be local, not “Local”.

  • if statements is “if”, not “If” & are normally on one line.

  • Please learn if statements and how they work here.

  • Please close your lines, to stop syntax errors.

  • Try using SetPrimaryPartCFrame.

  • Make a primary part for your model.

  • Read the tags I added in code.

  • Change cloned parent to workspace.

  • Don’t be afraid to ask me questions.

The code I have made for you:

Sending in a minute or so.

One more thing, to. ALWAYS READ YOUR OUTPUT.

I always read my output, I can catch errors in there.

1 Like

Yes, I love to hear that.

1 Like

should i make it into a local script and put it into ‘ServerScriptService’?

also, it said read the tags I added into it in ‘Tips’

Yeh, comments (Like – things) to be precise:

local groupId = 12760887 --Define the GroupId variable
local rank = 0 --Define the MinRank Variable
local Model = game.ReplicatedStorage:WaitForChild("Model")  --Wait to see if "Model" is inside of Replicated Storage, just incase a loading issue or something else affects it.

game.Players.PlayerAdded:Connect(function(player) --When the player joins get the Player Instance.
	player.Chatted:Connect(function(msg) --Detect whenthe player chats and get the message they sent. 
		if msg == ":spawn plane" and player:GetRankInGroup(groupId) == rank then --Check the msg they sent, see if the message is ":spawn plane" and check if the person has the correct rank, if they do continue.
			Model:Clone() --Clone the model we defined earlier on.
			Model.Parent = game.Workspace --Set the models parent, so we can see it in workspace.
			Model:MoveTo(player.Character.HumanoidRootPart.Position) --Set the model to be were the player is.

If this worked for you mark it as soloution!

ServerScriptService never uses local script(s), it should be a script in ServerScriptService.