So am making a gui where you click the place part button to place a part at the players position and you can do this up to 9 times then you can input a number into a textbox from 1-9 then you click the teleport to part button which it will then teleport you to that specific part, there is also a button that can destroy all the parts but when I click that it destroys them but I am unable to place new parts again with the place part button.
PlacePartButton Local Script:
local button = script.Parent
local root = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart")
local debounce = false
local number = script.Parent.Parent.Parent.Value.Value
script.Parent.MouseButton1Click:Connect(function()
if debounce then return end
if number < 9 then
local part = Instance.new("Part")
part.Position = root.Position
part.Parent = workspace
part.Anchored = true
part.CanCollide = false
part.BrickColor = BrickColor.Random()
part.Transparency = 0.5
number = number +1
part.Name = "telePart"..number
debounce = true
wait(0.5)
debounce = false
end
end)
TeleportToPartButton Local Script:
local root = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart")
local Input = script.Parent.Parent.Input
script.Parent.MouseButton1Click:Connect(function()
local text = string.lower(tostring(Input.Text))
if text == "1" or text:find("1") then
root.CFrame = game.Workspace.telePart1.CFrame + Vector3.new(0,2,0)
else
if text == "2" or text:find("2") then
root.CFrame = game.Workspace.telePart2.CFrame + Vector3.new(0,2,0)
else
if text == "3" or text:find("3") then
root.CFrame = game.Workspace.telePart3.CFrame + Vector3.new(0,2,0)
else
if text == "4" or text:find("4") then
root.CFrame = game.Workspace.telePart4.CFrame + Vector3.new(0,2,0)
else
if text == "5" or text:find("5") then
root.CFrame = game.Workspace.telePart5.CFrame + Vector3.new(0,2,0)
else
if text == "6" or text:find("6") then
root.CFrame = game.Workspace.telePart6.CFrame + Vector3.new(0,2,0)
else
if text == "7" or text:find("7") then
root.CFrame = game.Workspace.telePart7.CFrame + Vector3.new(0,2,0)
else
if text == "8" or text:find("8") then
root.CFrame = game.Workspace.telePart8.CFrame + Vector3.new(0,2,0)
else
if text == "9" or text:find("9") then
root.CFrame = game.Workspace.telePart9.CFrame + Vector3.new(0,2,0)
end
end
end
end
end
end
end
end
end
end)
DeletePartsButton Local Script:
script.Parent.MouseButton1Click:Connect(function()
game.Workspace.telePart1:Destroy()
game.Workspace.telePart2:Destroy()
game.Workspace.telePart3:Destroy()
game.Workspace.telePart4:Destroy()
game.Workspace.telePart5:Destroy()
game.Workspace.telePart6:Destroy()
game.Workspace.telePart7:Destroy()
game.Workspace.telePart8:Destroy()
game.Workspace.telePart9:Destroy()
game.Workspace.telePart10:Destroy()
script.Parent.Parent.Parent.Value.Value = 0
end)
I hope this was not to confusing. Thanks.
