So I'm fairly new to coding and I'm trying to figure out how I can make it so it checks to see if there is a specific child. If there is said child for it to not do anything. This is probably the best way I'm going to be able to explain it currently.
I've tried this
local Activat = script.Parent
local TemplateL = Activat.TemplateL
local TemplateR = Activat.TemplateR
local ActivCode = game.ServerStorage.Fireballclone
local ActivCodee = game.ServerStorage.Power
local function Open (part)
local parent = part.parent
if game.Players:GetPlayerFromCharacter(parent)then
local activater = ActivCode:Clone()
local activates = ActivCodee:Clone()
activater.Parent = game.Workspace.Cannon
activates.Parent = game.Workspace.Cannon
end
end
local removed = workspace.Cannon:FindFirstChild("Power",true)
if removed == true then
wait(2)
else
TemplateL.Opener.Touched:Connect(Open)
end
I know this is wrong but again I want to figure out a way for the script to be able to tell if there is already a "Power" child within workspace.cannon and if not for it to only work when there isn't a "Power" child already in workspace.cannon. Thank you.
Just in case. This script is meant to work in conjunction with this other script
local Activ = script.Parent
local TemplateL = Activ.TemplateL
local TemplateR = Activ.TemplateR
local ActivCode = game.ServerStorage.Fireballclone
local ActivCodee = game.ServerStorage.Power
local function Close (part)
local parent = part.parent
if game.Players:GetPlayerFromCharacter(parent)then
workspace.Cannon.Fireballclone:Destroy()
workspace.Cannon.Power:Destroy()
wait(1)
end
end
TemplateR.Closer.Touched:Connect(Close)
