Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Text box where if a players name is typed a model of them will appear?

Asked by 4 years ago

Hello, I have been trying to make a gui so when you put a players name A model of them will appear, if anyone could help that would be great.

0
I think he was talking about the in-game players. LazokkYT 117 — 4y
0
I have to get this straight. it has to be in game, and it can be any player that has a roblox account, it just has to be their name. O_OIMGONE 9 — 4y

2 answers

Log in to vote
0
Answered by
zomspi 541 Moderation Voter
4 years ago
Edited 4 years ago

You can just clone the character of the player:

There are 2 ways to do this; Option 1: Where every player can see the model. Option 2: Just you can see the model, the first option I will do now:

Option 1 - Local Script (TextBoxI)

1local textbox = script.Parent -- Change to text box
2textbox:GetPropertyChangedSignal("Text"):Connect(function() -- Detect when a player writes into the field
3if textbot.Text == game.Players.LocalPlayer.Name then
4game.ReplicatedStorage.SpawnCharacter:FireServer() -- You need a remote event in replicated storage, name it SpawnCharacter
5end
6end)

Option 1 - Server Script (ServerScriptService

01game.ReplicatedStorage.SpawnCharacter.OnServerEvent:Connect(function(player)
02if player.Character then - Checks to see if they have a character
03if game.Workspace:FindFirstChild("Model"..player.Name) then
04game.Workspace:FindFirstChild("Model"..player.Name) :Destroy() -- This prevents them from spawning multiple copies of themselves
05wait(0.1)
06local model = player.Character:Clone()
07model.Parent = game.Workspace
08model.Name = "Model "..player.Name
09model:SetPrimaryPartCFrame(player.Character.PrimaryPart.CFrame + Vector3.new(0,0,-15)) -- This will spawn the model in front of the player, you can adjust the offset of the position to change it, (x,y,z)
10else
11local model = player.Character:Clone()
12model.Parent = game.Workspace
13model.Name = "Model "..player.Name
14model:SetPrimaryPartCFrame(player.Character.PrimaryPart.CFrame + Vector3.new(0,0,-15)) -- This will spawn the model in front of the player, you can adjust the offset of the position to change it, (x,y,z)
15end
16end
17end)

Option 2 - Local Script (TextBox)

01local textbox = script.Parent -- Change to text box
02local player = game.Players.LocalPlayer
03textbox:GetPropertyChangedSignal("Text"):Connect(function() -- Detect when a player writes into the field
04if textbot.Text == player.Name then
05if game.Workspace:FindFirstChild("Model"..player.Name) then
06game.Workspace:FindFirstChild("Model"..player.Name) :Destroy() -- This prevents them from spawning multiple copies of themselves
07wait(0.1)
08local model = player.Character:Clone()
09model.Parent = game.Workspace
10model.Name = "Model "..player.Name
11model:SetPrimaryPartCFrame(player.Character.PrimaryPart.CFrame + Vector3.new(0,0,-15)) -- This will spawn the model in front of the player, you can adjust the offset of the position to change it, (x,y,z)
12else
13local model = player.Character:Clone()
14model.Parent = game.Workspace
15model.Name = "Model "..player.Name
16model:SetPrimaryPartCFrame(player.Character.PrimaryPart.CFrame + Vector3.new(0,0,-15)) -- This will spawn the model in front of the player, you can adjust the offset of the position to change it, (x,y,z)
17end
18end
19end)

Please feel free to ask any questions, if I helped please accept this answer!

0
this didnt work. O_OIMGONE 9 — 4y
Ad
Log in to vote
0
Answered by
Nckripted 580 Moderation Voter
4 years ago

Get the text inside the text box, then search the workspace for their model. Make a clone of it, and parent it inside the ObjectWindow (can't remember what it is called). This should make your code work.

Answer this question