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

oh okay. I’ll try out the script.

it works once, but then it just starts spawning randomly

What do you mean?

Do you have any other scripts that could interfere with the process?

I’ll send you a video.

1 Like

it won’t let me upload the video

ill just explain it.

So when i type in ‘:spawn plane’ it does spawn at my character but then if i walk away and type it up again, it just starts spawning next to me.

actually that could be useful lol

thank you so much cookie! :smiley:

the only problem is that it spawns quite far away from me.

Alright, can you send a screenshot when it spawns far from you?

Okay. Also I tried making a delete plane command and its supposed to put it back into ‘Replicated storage’
but that only works once then it stops spawning in.

That’s not the best way to do it.

It’s a typo, in my code.

This should fix it.

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.
			local clone = Model:Clone() --Clone the model we defined earlier on.
			clone.Parent = game.Workspace --Set the models parent, so we can see it in workspace.
			clone:MoveTo(player.Character.HumanoidRootPart.Position) --Set the model to be were the player is.
		end
	end)
end)


I just added this onto the end of my code:

player.Chatted:Connect(function(msg) --Detect whenthe player chats and get the message they sent. 
				if msg == ":delete plane" and player:GetRankInGroup(groupId) == rank then
					Model.Parent = game.ReplicatedStorage

but when i do that it doesn’t let me delete the planes

and it spawns unlimited planes

here’s what’s gonna happen if i don’t fix this glitch:

Are you using this updated code I just sent you?

That fixes the issue.

Im using that one and it does spawn at my location but you can spawn as many as you want,