I can't seem to figure out how to the 'check' function, the script was functional up until I got to making the check.
I am rusty so please forgive me if it is a simple issue, I haven't attempted deving for a good year.
script.Parent.Touched:connect(function(hit) if hit.Parent then local hum = hit.Parent:FindFirstChild("Humanoid") if not hum then print('Wasnt a humanoid') else local egg_plot = game.ServerStorage.Egg_Plot:Clone() egg_plot.Parent = game.Workspace function check() local already_in_workspace = game.Workspace.Egg_Plot if already_in_workspace.Parent == game.Workspace then egg_plot:Destroy() else print('there wasnt an Egg Plot in workspace') end end check() end end end)
You created a function inside of an if statement, you don't really need the function in the first place, and even if that did work, you have executed the function outside of the if statement you were intending it to be in.
script.Parent.Touched:connect(function(hit) if hit.Parent then local hum = hit.Parent:FindFirstChild("Humanoid") if not hum then print('Wasnt a humanoid') else local egg_plot = game.ServerStorage.Egg_Plot:Clone() egg_plot.Parent = game.Workspace local already_in_workspace = game.Workspace.Egg_Plot if already_in_workspace.Parent == game.Workspace then egg_plot:Destroy() else print('there wasnt an Egg Plot in workspace') end end end end end)
And that's all that it needed. Hope this helped!