local button = script.Parent
function onclick()
--finds spawn--
local player = script.Parent.Parent.Parent.Parent.Character
local playerPos = player.Torso.Position
local g = Instance.new("Part")
g.Parent = playerPos
end
script.Parent.MouseButton1Click:connect(onclick)
i am trying to insert a part where the player is but it just wont work. is there anything that i could change to make it work?

3 comments
Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
it was relevant because there is something wrong in the script so i asked you guys to help me find what is wrong in the script and how can i fix it?
Be more exact. A general statement such as the one you used is not exact. Provide more detail. Include what its about, such as MouseButton1Click.