Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why can't a workspace event trigger anything?

Asked by 1 year ago
Edited by Xapelize 1 year ago
So I'm making a survival game right now, and I'm trying to make it so that if you have 0 of a specific resource, the image of the resource in your inventory is desaturated and dark, but if you have 1 or above, it is its normal color. I want it to make the desaturated color invisible when you obtain some of the resource, but just won't work.

I've tried swapping the scripts between local scripts and normal scripts to test whatever but nothing worked.

Right now,  I have choppable trees, but at the end of the tree's script it has the darker image disappear, onlym it doesn't disappear. I'm getting no errors, and I simply have no idea of what's going on. Here's the tree's script, (Script in a model in the workspace).

local Log = script.Parent.Log local Leaves = script.Parent.Leaves local hits = 0 local totalhits = 5 local Hit = script.Parent.Hit local Leaves2 = script.Parent.Leaves2

Log.Touched:Connect(function(hit) if hit.Parent.Name == "axe" then hits = hits + 1 Hit:Play() 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 Leaves2.Anchored = false Leaves2.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)

And here's everything else I'm working with, (Script in StarterGui.GameGui, and has been switched between a script and a local script).

local invframe = script.Parent.InvFrame local woodbutton = script.Parent.InvFrame.ScrollingFrame.WoodButton local nolog = script.Parent.InvFrame.ScrollingFrame.WoodButton.ImageLabel local intel = script.Parent.InvFrame.DetailsFrame

woodbutton.MouseButton1Click:Connect(function() if game.Workspace.Tree.Check.Value == false then print("You don't have any logs...") else invframe.ScrollingFrame:TweenSizeAndPosition(UDim2.new(0.528,0,0.578,0), (The previous line continued) UDim2.new(0.035,0,0.17,0), "Out", "Quint", 0.4, true) wait(0.3) intel.Visible = true intel.ImageLabel.Visible = true intel.DetailsLabel.Visible = true intel.DetailsLabel.DetailsLabelName.Visible = true intel.DetailsLabel.DetailsLabelName.Text = "LOGS" intel.ImageLabel.Image = woodbutton.Image intel.InfoLabel.Text = "THE VERY BASIC BUILDING RESOURCE OF NATURE. USE THEM TO BUILD SHELTERS, WALLS, AND OTHER DEFENSES." end end) Can someone help me please?? I've been doing this for three hours and I'm completely clueless.

Answer this question