Last question: When the string Value Changes from "empty" to "water" as said in this script: How does the state best be handled,? Or How would I set the state as a function?
script.Parent.Handle.Touched:connect(function(touchedpart)
local state = touchedpart:FindFirstChild("State") if( state ~= nil )then -- door has a state, so it is either open or closed if( state.Value == "empty" )then -- set the door's state to "open" state.Value = "water" -- actually move the door/destroy the door so it opens aka perform the action -- for example: touchedpart:Destroy() -- destroy the key script.Parent:Destroy() end end end)
Here is my current Function Handling:
function StateChange4() script.Parent.State.Value = "water" Fluid.Transparency = 0 end
The "State" is a StringValue class object whose Parent is Door; aka, it's a "real" object
Therefore;
local StateChange4 = function() game.Workspace.Door.State.Value = "water" Fluid.Transparency = 0 -- other stuff to do end