Placing the part where the player position is trouble

I’m trying to make it so whenever you click on a button a new part is created in workspace and the position of the part is the position of the player, it captures the position but does not put the part to the position. Please help

local Replicated = game.ReplicatedStorage

local EventsFolder = Replicated.EditingEvents
local PartsFolder = Replicated.Parts

local SyncedPartNames = EventsFolder.SavedPartNames

local player = game:GetService("Players").LocalPlayer

local Players = game.Players

local WarnTime = 1

local HumanoidPosition = game.ReplicatedStorage.PlayerSettings.PlayerPosition.Value

PlayerName = player.Name

script.Parent.MouseButton1Click:Connect(function()
	local PartClone = PartsFolder.Part:Clone()
	PartClone.Parent = game.Workspace
	PartClone.Position = Vector3.new(HumanoidPosition)
	PartClone.Anchored = true
	PartClone.CanCollide = false
	wait(WarnTime)
	PartClone.CanCollide = true
end)


while wait(0.001) do
	for i,v in pairs(Players:GetChildren()) do
		local HumanoidPos = game.Workspace:WaitForChild(v.Name).HumanoidRootPart.Position
		game.ReplicatedStorage.PlayerSettings.PlayerPosition.Value = HumanoidPos
	end
end


robloxapp-20230114-1902258.wmv (1.4 MB)

Hi I found the problem. I see you use Vector3.new(HumanoidPosition). Instead, HumanoidPosition is already a vector3 value. So instead, you can just use PartClone.Position = HumanoidPosition

Hope this help.

I actually just tried this.
robloxapp-20230114-1902258.wmv (1.4 MB)
It still did not work.

Maybe try this. Because I think while wait(0.001) do will be unefficient and it will not update on time.

Procedure:

  1. Remove the while loop
  2. Add a character variable on top. (local Character = player.Character or player.CharacterAdded:Wait()
  3. PartClone.Position = Character.HumanoidRootPart.Position
1 Like

It works but do you know how to make the part on the ground?
RobloxScreenShot20230114_190957826

I do! Make the part unanchored at first and after warn time, set it to anchored.

Thank you! It works. Finally someone that knows how to do it lol

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.