Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Trying to spawn part at player on tool click, no errors? [SOLVED]

There aren't any errors as I said, so I can't figure out what's wrong.. I am a complete noob when it comes to scripting so... If you answer my question pls explain the logic behind your answer, helps a ton.

--// Vars \\--
local User = game.Players.LocalPlayer
local Char = User:WaitForChild("Character")
local humanoidrootpart = Char.HumanoidRootPart

--// Settings \\--
local newpart = Instance.new("Part",workspace)
local position = Char.HumanoidRootPart.CFrame

--// Part Spawn \\--

script.Parent.Equipped:Connect(function(Mouse)
	Mouse.Button1Down:Connect(function()
newpart.BrickColor = BrickColor.new("Burnt Sienna")
newpart.Material = Enum.Material.Neon
newpart.Anchored = true
newpart.CFrame = position
newpart.Parent = game.Workspace
	end)
end)	

1 answer

I found that the problem lied in how I was trying to get to the character, the char didn't actually exist yet so I had to use :CharacterAdded, Ankur_007 helped out by answering another post of mine.

This discussion is preserved as it was. New answers, comments, and votes are closed.