So, i want it to be so if you equip your tool it will print like ('equipped') but it dosent do that right now and i cant seem why it dosent do that at the moment any help?
Script.
repeat wait() until script:IsDescendantOf(game.StarterGui) == false
local plr = game.Players.LocalPlayer
local chr = plr.Character
local tool = plr.Backpack:WaitForChild("Pickaxe")
local toolSpeed = 30
local step = game:GetService("RunService").RenderStepped
local input = game:GetService("UserInputService")
local orename = plr.PlayerGui.ScreenGui.OreName
local equipped = false
local holding = false
local target = nil
local SelectionBox = Instance.new("SelectionBox")
SelectionBox.Color3 = Color3.new(0, 202/255, 212/255)
SelectionBox.LineThickness = 0.1
SelectionBox.SurfaceColor3 = Color3.new(170/255, 1, 1)
SelectionBox.SurfaceTransparency = 0.9
function MinedOre(ore)
game.ReplicatedStorage.ServerAndClient.MineOre:FireServer(ore)
end
tool.Equipped:connect(function()
print('equipped')
equipped = true
SelectionBox.Parent = game.Workspace.CurrentCamera
end)
tool.Unequipped:connect(function()
print('Unequipped')
equipped = false
SelectionBox.Parent = nil
end)
input.InputChanged:connect(function(inp)
if inp.UserInputType == Enum.UserInputType.MouseMovement then
local mouse = plr:GetMouse()
target = mouse.Target
if mouse then
if mouse.Target ~= nil and mouse.Target.Name == "Ore" then
orename.Text = mouse.Target:GetChildren()[1].Name
orename.TextColor3 = mouse.Target:GetChildren()[1].Value
if mouse.Target.LockedValue == false then
SelectionBox.Color3 = Color3.new(0, 202/255, 212/255)
else
SelectionBox.Color3 = Color3.new(1, 0, 0)
end
SelectionBox.Adornee = mouse.Target
else
orename.Text = ""
end
end
end
end)
input.InputBegan:connect(function(inp)
if inp.UserInputType == Enum.UserInputType.MouseButton1 then
holding = true
local mouse = plr:GetMouse()
if equipped and mouse.Target ~= nil and mouse.Target.Name == "Ore" then
if mouse.Target.LockedValue == false then
SizeBarAndMine(mouse.Target.Hardness.Value/toolSpeed,mouse.Target)
end
end
end
end)
input.InputEnded:connect(function(inp)
if inp.UserInputType == Enum.UserInputType.MouseButton1 then
holding = false
end
end)
function CreateOreFrame(ore,Ammount,i)
local ID = ore.InterfaceTexture.Value
local frame = Instance.new("Frame",script.Parent.ScrollingFrame)
frame.Size = UDim2.new(0.9, -10,0.03, 0)
frame.Position = UDim2.new(0.05, 0,0.01+(0.03*(i-1)), 0)
frame.BackgroundTransparency = 1
local Image = Instance.new("ImageLabel", frame)
Image.Size = UDim2.new(0.2, 0,1, 0)
Image.BackgroundTransparency = 1
Image.Image = "rbxgameasset://"..ID
local Text = Instance.new("TextLabel", frame)
Text.Size = UDim2.new(0.75, 0,1, 0)
Text.Position = UDim2.new(0.25, 0,0, 0)
Text.BackgroundTransparency = 1
Text.Font = "Arial"
Text.TextColor3 = ore.Color.Value
Text.TextStrokeColor3 = Color3.new(0.75, 0.75, 0.75)
Text.Text = ore.Name..": "..tostring(Ammount)
Text.TextXAlignment = "Left"
end
function SizeBarAndMine(s,theOre)
plr.PlayerGui.ScreenGui.MinerTimer.Visible = true
local YouGotIt = false
local i = 0
repeat
local st = tick()
step:wait()
local en = tick()
local passed = en-st
i = i + passed
plr.PlayerGui.ScreenGui.MinerTimer.Bar.Size = UDim2.new(1/s*(passed*60),0)
if equipped == false or holding == false or theOre ~= target then
YouGotIt = false
break
end
until i >= s
plr.PlayerGui.ScreenGui.MinerTimer.Bar.Size = UDim2.new(0,0,1,0)
plr.PlayerGui.ScreenGui.MinerTimer.Visible = false
if YouGotIt == true then
game.ReplicatedStorage.ServerAndClient.MineOre:FireServer(theOre)
end
end
while wait() do
local pos = (chr.HumanoidRootPart.Position.Y-6)
if pos<-1 then
pos = math.abs(chr.HumanoidRootPart.Position.Y-6)
plr.PlayerGui.ScreenGui.Height.Text = tostring(pos/6):match("%d+")
if tostring(pos/6):match(".%d") ~= nil and string.sub(tostring(pos/6):match(".%d"),2) ~= "0" and string.sub(tostring(pos/6):match(".%d"),1 ,1) == "." then
plr.PlayerGui.ScreenGui.Height.Text = plr.PlayerGui.ScreenGui.Height.Text..tostring(tonumber(pos)/6):match(".%d").." m"
else
plr.PlayerGui.ScreenGui.Height.Text = plr.PlayerGui.ScreenGui.Height.Text.." m"
end
else
plr.PlayerGui.ScreenGui.Height.Text = "0 m"
end
end

4 comments
It could be a WaitForChild infinitely waiting. Whenever you test it, give it a bit and see if you get an alert in the console.
it isnt anything in the output completly clear
As Nathan said it could be an infinite :WaitForChild() wait, or where is this script currently located?
it is in the startergui thingy