hey,
I’m currently working on a tycoon/simulator game and somehow is my script not working
The script :
local mouse = game.Players.LocalPlayer:GetMouse()
local mouseposition = mouse.Hit.Position
local player = game.Players.LocalPlayer
local Chr = player.Character
local mon = player:WaitForChild(“AISDHAOSDHASI”):FindFirstChild(“2940u10iashöodwe”).Value
local hold = false
mouse.Button1Down:Connect(function()
hold = true
local tycoon = workspace.Tycoons:FindFirstChild(player.UserId)
while hold do --while button is hold
if tycoon then --checks for the tycoon
if tycoon:FindFirstChild("field1") then
local field = tycoon:FindFirstChild("field1")
local fold = field:FindFirstChild("Folder")
local wheats = fold:GetChildren()
if Chr:FindFirstChild("starter") then -- checks if player has starter tool equipped
for v, i in pairs(wheats) do
if i and i:IsA("MeshPart") then
local distance = (i.Position - mouseposition).Magnitude -- gets distance
if distance < 3 then
i.Transparency = 1
mon += 1
wait(60)
i.Transparency = 0
end --ends if distance
end--ends if i
end --ends for v,i
elseif Chr:FindFirstChild("firstupdate") then
for v, i in pairs(wheats) do
if i and i:IsA("MeshPart") then
local distance = (i.Position - mouseposition).Magnitude -- gets distance
if distance < 5 then
i.Transparency = 1
mon += 1
wait(60)
i.Transparency = 0
end --ends if distance
end--ends if i
end --ends for v,i
elseif Chr:FindFirstChild("secondupdate") then
for v, i in pairs(wheats) do
if i and i:IsA("MeshPart") then
local distance = (i.Position - mouseposition).Magnitude -- gets distance
if distance < 7 then
i.Transparency = 1
mon += 1
wait(60)
i.Transparency = 0
end --ends if distance
end--ends if i
end --ends for v,i
elseif Chr:FindFirstChild("thirdupdate") then
for v, i in pairs(wheats) do
if i and i:IsA("MeshPart") then
local distance = (i.Position - mouseposition).Magnitude -- gets distance
if distance < 9 then
i.Transparency = 1
mon += 1
wait(60)
i.Transparency = 0
end --ends if distance
end--ends if i
end --ends for v,i
elseif Chr:FindFirstChild("fourthupdate") then
for v, i in pairs(wheats) do
if i and i:IsA("MeshPart") then
local distance = (i.Position - mouseposition).Magnitude -- gets distance
if distance < 11 then
i.Transparency = 1
mon += 1
wait(60)
i.Transparency = 0
end --ends if distance
end--ends if i
end --ends for v,i
end --ends chr:findfirstchild
elseif tycoon:FindFirstChild("field2") then
local field = tycoon:FindFirstChild("field2")
local fold = field:FindFirstChild("Folder")
local wheats = fold:GetChildren()
if Chr:FindFirstChild("starter") then -- checks if player has starter tool equipped
for v, i in pairs(wheats) do
if i and i:IsA("MeshPart") then
local distance = (i.Position - mouseposition).Magnitude -- gets distance
if distance < 3 then
i.Transparency = 1
mon += 3
wait(60)
i.Transparency = 0
end --ends if distance
end--ends if i
end --ends for v,i
elseif Chr:FindFirstChild("firstupdate") then
for v, i in pairs(wheats) do
if i and i:IsA("MeshPart") then
local distance = (i.Position - mouseposition).Magnitude -- gets distance
if distance < 5 then
i.Transparency = 1
mon += 3
wait(60)
i.Transparency = 0
end --ends if distance
end--ends if i
end --ends for v,i
elseif Chr:FindFirstChild("secondupdate") then
for v, i in pairs(wheats) do
if i and i:IsA("MeshPart") then
local distance = (i.Position - mouseposition).Magnitude -- gets distance
if distance < 7 then
i.Transparency = 1
mon += 3
wait(60)
i.Transparency = 0
end --ends if distance
end--ends if i
end --ends for v,i
elseif Chr:FindFirstChild("thirdupdate") then
for v, i in pairs(wheats) do
if i and i:IsA("MeshPart") then
local distance = (i.Position - mouseposition).Magnitude -- gets distance
if distance < 9 then
i.Transparency = 1
mon += 3
wait(60)
i.Transparency = 0
end --ends if distance
end--ends if i
end --ends for v,i
elseif Chr:FindFirstChild("fourthupdate") then
for v, i in pairs(wheats) do
if i and i:IsA("MeshPart") then
local distance = (i.Position - mouseposition).Magnitude -- gets distance
if distance < 11 then
i.Transparency = 1
mon += 3
wait(60)
i.Transparency = 0
end --ends if distance
end--ends if i
end --ends for v,i
else
end --ends Chr:FindFirstChild
else
end --ends if field2
else
end --ends if tycoon
wait()
end--ends while hold
end) --ends function