I am having a problem with an if statement, I am trying to do so the code won't execute if there is an object in the workspace called "Laser" and if he has a child that is named the Player's name.
if game.Workspace:FindFirstChild("Laser"):FindFirstChild(Player.Name)then print("LaserInActionAlready") elseif not game.Workspace:FindFirstChild("Laser"):FindFirstChild(Player.Name)then wand.Activated:Connect(function(Mouse) local Mousehit = game.Players.LocalPlayer:GetMouse().Hit local Mousehitp = game.Players.LocalPlayer:GetMouse().Hit.p if script.Busy.Value == true then script["Aqua eructo"].Disabled = true end if script.Busy.Value == false then if enabled == true then enabled = false if not script["Aqua eructo"].Disabled == true then script.Done.Value = false script["Aqua eructo"].RemoteEvent:FireServer(Mousehitp,Mousehit)
Why the first 3 lines won't make sure that the remote event doesn't get fired if there is an object called "Laser" and inside it an object with the character's name that is my question, I would be happy if someone could help.
This is because the script you have isn’t wrapped in a function, loop, or event.
Since you didn’t wrap it into one of these, the if statements automatically ran, and checked only once. Another error is you put your Tool.Activated
event inside an of statement, which is not okay. On top of that, you tried to pass the mouse as a parameter. The Tool.Activated
event has no parameters.