Basically I have a script to cut down a tree. Works fine and everything in studio, but when it comes to playing normally it just doesn't do a thing or even say anything in the dev console. Here is the script, if you have any idea that would be great.
local tool = script.Parent
local player = tool.Parent.Parent
debounce = true
player:WaitForDataReady()
function Collect(mouse)
if mouse.Target ~= nil then
if mouse.Target.Parent.Name == "Tree1" then
local thetree = mouse.Target.Parent
if (mouse.Target.Position - player.Character.Torso.Position).magnitude <= 20 then
if thetree.Hide.Value == 0 then
if debounce == true then
local origwalkspeed = player.Character.Humanoid.WalkSpeed
debounce = false
player.Character.Humanoid.WalkSpeed = 0
local bg = Instance.new("BillboardGui")
bg.Parent = player.PlayerGui
bg.Adornee = player.Character.Head
bg.Size = UDim2.new(4, 0, 4, 0)
bg.StudsOffset = Vector3.new(0, 5, 0)
local il = Instance.new("ImageLabel")
il.Parent = bg
il.Image = "http://www.roblox.com/asset/?id=420600020"
il.Size = UDim2.new(1, 0, 1, 0)
il.BackgroundTransparency = 1
wait(thetree.Time.Value)
bg:remove()
player.Character.Humanoid.WalkSpeed = origwalkspeed
player.leaderstats.Wood.Value = player.leaderstats.Wood.Value + thetree.GiveAmount.Value
debounce = true
thetree.Hide.Value = 1
end
end
end
end
end
end
script.Parent.Selected:connect(function(mouse)
mouse.Button1Down:connect(function() Collect(mouse) end)
end)

10 comments
Do you get any errors?
I get nothing at all from it
Well I have no idea..
If it helps, this script is for an axe tool. The tree's are other models in workspace which have their own values inside each of them such as respawn time, cutting time and value.
Put some prints in the script to test it. When you run the game, check to see what things got printed and which ones didn't.
It doesn't print anything past the first function or even the first function infact
maybe it's the WaitForDataReady()??
I've tried removing it and assigning it to other things, not happening :/
Try completely getting rid of line 54 and replacing it with, mouse.Button1Down:connect(Collect). The way you did it seems like it might be causing a problem.
I worked out I was using a HopperBin! Such an idiot. So yeah I changed it to a Tool used a Localscript and modified the script a bit to work with a Tool. But got it working! Thanks guys (: