Goal: I would like one script (script A) to allow another script to work (script B) based on transparency.
Problem #1: Is it possible to store my tools in ServerStorage rather than Lighting?
Problem #2: How can I make it so one script CANNOT function until the transparency of it is equal to 0?
Problem #3: Are the booleans false
and nil
completely alike?
Other Information:
WORKSPACE: Project (folder) -> Functions (folder) -> HammerGiver, HammerOutput, WrenchGiver, WrenchOutput, Planks (grouped model)
LIGHTING: Tools (folder) -> Hammer, Wrench
HAMMER GIVER/INPUT SCRIPT
function OnClick(PersonWhoClicked) local y = PersonWhoClicked.Backpack local z = game.Lighting.Tools["Hammer"] --hammer stored in "Tools" folder in "Lighting" z:Clone().Parent = y --gives hammer to player game.Workspace.Project.Functions.HammerGiver:Destroy() --destroys hammer giver end script.Parent.ClickDetector.MouseClick:connect(OnClick)
HAMMER OUTPUT SCRIPT
script.Parent.Touched:connect(function(p) if p.Parent.Name == "Hammer" then game.Workspace.Project.Functions.HammerOutput.MeshPart.Transparency = 0 --allows the new location of the hammer to be visible p.Parent:Destroy() --destroys tool from backpack game.Workspace.Project.Functions.Planks.Plank1.Anchored = false --allows wooden plank borders to fall game.Workspace.Project.Functions.Planks.Plank2.Anchored = false game.Workspace.Project.Functions.WrenchGiver.MeshPart.Transparency = 0 --reveals next objective or object for game end end)
WRENCH GIVER/INPUT SCRIPT PROBLEM!!!
function OnClick(PersonWhoClicked) local y = PersonWhoClicked.Backpack local z = game.Lighting.Tools["Wrench"] --gives wrench from "Lighting" z:Clone().Parent = y game.Workspace.Project.Functions.WrenchGiver:Destroy() --destroys tool giver end script.Parent.ClickDetector.MouseClick:connect(OnClick)
Notes: -hammer transparency is 0 -wrench transparency is 1
POSSIBLE SOLUTIONS 1) How do I make it so the WrenchGiver does not work until the MeshPart transparency is 0? 2) How do I remove the ClickDetector from the WrenchGiver until the MeshPart transparency is 0?
After I set the transparency for the WrenchGiver (input), it doesn't give me the tool, but rather says attempt to call a nil value
and I don't know what to do. In the output it states, Attempt to connect failed: Passed value is not a function
and it was located in Script 'Workspace.Project.Functions.WrenchGiver.Script', Line 13
.