So I have spent a great deal of time working on perfecting this tool. Now I am wanting to change it so that the same effect of the tool. How can I easily convert the functions so that the rest of the script is triggered when the TextButton is clicked?
local frame = script.Parent.Parent.Parent:WaitForChild('Items') script.Parent.MouseButton1Click:connect(function() frame.Visible = not frame.Visible end) tool = script.Parent grid = 3 grid2 = 6 function click(mouse) --- This line and below are what I need to know how to convert local Spawn = game.Workspace.start local Pos =(Vector3.new((mouse.Hit.p.X+grid) - (mouse.Hit.p.X+grid)%grid2, (Spawn.Position.Y+0.5), (mouse.Hit.p.Z+grid) - (mouse.Hit.p.Z+grid)%grid2)) --tree stump local part = game.ReplicatedStorage.Table:Clone() part.Position = Pos part.Parent = game.Workspace print("Tree Placed") end function selected(mouse) mouse.Button1Down:connect(function () click(mouse) end) wait(2) end tool.Equipped:connect(selected)
put click()
and selected()
inside
script.Parent.MouseButton1Click:Connect(function() frame.Visible = not frame.Visible end)
like
script.Parent.MouseButton1Click:Connect(function() frame.Visible = not frame.Visible click() selected() end)