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

Why Isn't my GUI not spawning parts below the player?

Im making a GUI where If you press It a part will spawn below you but In this situation I want to make a GUI that spawns a part on the tool your holding (The tool I want the part spawn Is a sword name "Part" but It appears to not be working, this Is the code:

local Button = script.Parent

Button.MouseButton1Down:Connect(function(activate) local Part = Instance.new("Part") Part.Size = Vector3.new(2.33, 2.788, 2.519) Part.Position = Vector3.new(game.Workspace.Starterpack.part) Part.Parent = workspace Part.Anchored = true Part.BrickColor = BrickColor.new("Black") end)

2 comments

0

Hey I'm not sure what you mean , also please use the text-formats for posting the post.

0

Basically I want a GUI that spawns a part below the players feet

1 answer

Please use the lua code block formats. This should work:

Button = script.Parent

Button.MouseButton1Down:Connect(function()
	local Player = Button.Parent.Parent.Parent.Parent
	local Character = Player.Character
	local Part = Instance.new("Part") 
	Part.Size = Vector3.new(2.33, 2.788, 2.519) 
	Part.Position = Vector3.new(Character:FindFirstChildOfClass("Tool").Handle.Position - Vector3.new(0, 4, 0)) 
	Part.Parent = workspace
	Part.Anchored = true 
	Part.BrickColor = BrickColor.new("Black") 
end)

I'm also assuming this is a serverscript, and the button is located inside of a frame which is inside of a ScreenGui. If it doesn't work, add me on Discord: Undaub#4107

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