in this script I clone a seat from server storage when I equip a tool and when I have the tool unequipped it destroys it but the one thing I can't figure out is how to set its position to the player when I clone it also when giving an answer if you can explain how it works so I know what to do in the future that would be great!
here's the code:~~~~~~~~~~~~~~~~~ local tool = script.Parent local car = game.ServerStorage.Car
tool.Equipped:Connect(function(plr) local copy = car:Clone() copy.Parent = game.Workspace copy:MoveTo() tool.Unequipped:Connect(function() copy:Destroy() end) end) ~~~~~~~~~~~~~~~~~
Hi, so if the player is holding the tool, it will give you the coords. Here's an example:
local player = game:GetService("Players").LocalPlayer -- Put :GetService("") if its a service (Workspace, Players, etc.). local char = player.Character or player.CharacterAdded:Wait() -- Locates the character of player. local tool = script.Parent tool.Equipped:Connect(function() local humRoot = char:WaitForChild("HumanoidRootPart") -- Locates the HumanoidRootPart of player. print(humRoot.Position) -- Printing the position of HumanoidRootPart, which is the primary part of a player. end)
You can ask why it's not working, else good day.
This is really simple and easy, all you need to do is this:
local Character = plr.Character local Humrp = Character:WaitForChild("HumanoidRootPart")
local Position = Humrp.Position
That gives you the players position.