NOTE: Sorry, if this question is too long, or sounds like i’m begging, I tried following the questions. I’m trying to make a god-like game.
What do I want to achieve?
I want to achieve it so that when you click it always places the model above the ground, and there is a way to turn it off such as a button, I’d also want it so I can connect to it, as when you click on the NPC in non-build mode, it pops up a UI, where you can name and kill the model, etc, But i have no clue on how to register a new number for the name in workspace.
What is the issue?
Local Script From the Button:
local RemoteEvent = game:GetService("ReplicatedStorage").PlaceHuman local Cursor = game:GetService("Players").LocalPlayer:GetMouse() script.Parent.MouseButton1Click:Connect(function() Cursor.Button1Down:Connect(function() RemoteEvent:FireServer(Cursor.Hit.p) end) end)
local Number = 1 local RemoteEvent = game:GetService("ReplicatedStorage").PlaceHuman RemoteEvent.OnServerEvent:Connect(function(Player, CursorPos) local block = game.ReplicatedStorage.Blocks.NPC:Clone() block.Parent = workspace block.Name = Player.Name.. " 's " ..Number + 1 .. "NPC" block:SetPrimaryPartCFrame(CFrame.new(CursorPos)) end)
If any code is messy, or could be better done to prevent lag, that would be helpful as well! I looked but found no results, anywhere even on Scripting Helpers (even asked here!)
Sorry if it sounds like im begging.
If you have any questions or need a better explanation on what I’m confused on doing, just ask!