I'm making a survival game right now, and I'm trying to make it so that when you break down a tree, it makes the picture of wood in the inventory space go from a dark, desaturated filter to a normal shade, as when the dark image is visible then the inventory cannot be accessed from that button. But when the tree breaks it just doesn't do anything. I have the script for the tree as a (script inside a model inside the workspace), and the second UI script as a (Localscript in a frame, in a screengui, in the startergui). I've tried swapping them (Localscript to a script and the other way around), and including both codes into one script while also changing their locations. This is the UI script:
``woodbutton.MouseButton1Click:Connect(function() if nolog.Visible == true then print("You have no logs") else --(This is where stuff would happen) end end)
and the Tree script:
local Log = script.Parent.Log local Leaves = script.Parent.Leaves local hits = 0 local totalhits = 8 Log.Touched:Connect(function(hit) if hit.Parent.Name == "axe" then hits = hits + 1 if game.StarterPack.axe.Equipped == false then Log.Anchored = true Leaves.Anchored = true else if hits == totalhits then hits = 0 Log.CanTouch = false Log.Anchored = false Leaves.Anchored = false Leaves.CanCollide = false wait() Log.Rotation = Vector3.new(45,0,0) wait(3) Log:Destroy() game.StarterGui.GameGui.InvFrame.ScrollingFrame.WoodButton.ImageLabel.Visible = false print("Logs obtained") end end end end)
Please help me I have been asking this question fror 4 days and I don't know how to fix it.
Use RemoteEvents and/or RemoteFunctions. If you just look up a simple tutorial on YouTube you can learn it really quickly and easily.