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?
Your best friend when trying to remember what does what when coding is google. Specifically the api listing on https://developer.roblox.com/
For example, if you need to remember what a ClickDetector is or how to use it, just type "roblox clickdetector" in google, and you'll get the full api listing and usually examples of how to use whatever you are looking up. If you google something and aren't getting good results then you can narrow your search to just the roblox site. For example, if you are wanting to look up the roblox player object, a google search of "roblox player" will get you a lot of useless results, but if you type ""site:https://developer.roblox.com player" it will give you exactly what you need.
Look things like this up enough times and pretty soon you start to remember more and more, and if you're still stuck after looking something up then there are sites like this and the roblox forums where you can ask specific questions.