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)

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

Option 1 - Server Script (ServerScriptService

game.ReplicatedStorage.SpawnCharacter.OnServerEvent:Connect(function(player)
if player.Character then - Checks to see if they have a character
if game.Workspace:FindFirstChild("Model"..player.Name) then
game.Workspace:FindFirstChild("Model"..player.Name) :Destroy() -- This prevents them from spawning multiple copies of themselves 
wait(0.1)
local model = player.Character:Clone()
model.Parent = game.Workspace
model.Name = "Model "..player.Name
model: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)
else
local model = player.Character:Clone()
model.Parent = game.Workspace
model.Name = "Model "..player.Name
model: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)
end
end
end)

Option 2 - Local Script (TextBox)

local textbox = script.Parent -- Change to text box
local player = game.Players.LocalPlayer
textbox:GetPropertyChangedSignal("Text"):Connect(function() -- Detect when a player writes into the field
if textbot.Text == player.Name then
if game.Workspace:FindFirstChild("Model"..player.Name) then
game.Workspace:FindFirstChild("Model"..player.Name) :Destroy() -- This prevents them from spawning multiple copies of themselves 
wait(0.1)
local model = player.Character:Clone()
model.Parent = game.Workspace
model.Name = "Model "..player.Name
model: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)
else
local model = player.Character:Clone()
model.Parent = game.Workspace
model.Name = "Model "..player.Name
model: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)
end
end
end)

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

0
this didnt work. O_OIMGONE 9 — 3y
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