Some gentleman called SimpleFlame (?) posted this line of code for me local part = script.Parent
-- Create a new click detector
local ClickDetector = Instance.new("ClickDetector")
ClickDetector.Parent = part
ClickDetector.MaxActivationDistance = 10 -- Max distance a player can click the part
-- Set up the click function so our part can listen for clicks
ClickDetector.MouseClick:Connect(function(playerWhoClicked)
local newPart = Instance.new("Part")
newPart.Name = "SpawnPart"
newPart.Parent = workspace
Get the character from the playerWhoClicked parameter
local characterWhoClicker = playerWhoClicked.Character
local head = characterWhoClicker.Head -- Position the new part to the same position as the head plus 5 studs in the Y direction
newPart.CFrame = head.CFrame + Vector3.new(0, 5, 0)
end)
and while as a beginner this is somewhat difficult i found remembering it harder, any helps on this? maybe a simple explainatiion to each function/command shown here?
