I am using a plugin called Instance Tagging
i tagged the parts and the module thinks its referencing itself
I do not know why this is happening
i looped through every looped instance but still gives me the error
here is the error
18:44:30.297 - Touched is not a valid member of ModuleScript
18:44:30.299 - Stack Begin
18:44:30.301 - Script 'ServerStorage.Aero.Services.ShootingService', Line 159 - function Start
18:44:30.303 - Script 'Thread', Line 120
18:44:30.305 - Stack End
And here is the code
-- Shooting Service
-- FerbZides
-- June 18, 2020
--[[
Server:
Client:
--]]
local ShootingService = {Client = {}}
local ServerStorage = game:GetService("ServerStorage")
local CollectionService = game:GetService("CollectionService")
local OOBParts = CollectionService:GetTagged("OOBParts")
local ShootingParts = CollectionService:GetTagged("ShootingParts")
local Ball = ServerStorage:WaitForChild("Ball")
local ShootDebounce = false
function ShootingService:Start()
local function CloneBall(ActualPart)
local ClonedBall = Ball:Clone()
ClonedBall.Parent = workspace
ClonedBall.Ball.Position = ActualPart.Position
end
local function TeleportPlayers(Player, ActualPart, Speed)
-- Move Char
--[[ Sample Code
Player.Character:MoveTo(ActualPart.Position, ActualPart)
local Humanoid = Player.Character:WaitForChild("Humanoid")
Humanoid.WalkSpeed = Speed
]]
Player.Character:MoveTo(ActualPart.Position, ActualPart)
local Humanoid = Player.Character:WaitForChild("Humanoid")
Humanoid.WalkSpeed = Speed
end
local function SpeedPlayers(Team1Folder,Team2Folder,Speed)
for _, Player in pairs(game.Players:GetPlayers()) do
local Humanoid = Player.Character:WaitForChild("Humanoid")
local PadFolder = Player:WaitForChild("PadData")
local PadName = PadFolder:WaitForChild("PadName")
if Team1Folder:FindFirstChild(Player.Name) then
Humanoid.WalkSpeed = Speed
elseif Team2Folder:FindFirstChild(Player.Name) then
Humanoid.WalkSpeed = Speed
end
end
end
local function FireText(Team1Folder,Team2Folder,Text)
for _, Player in pairs(game.Players:GetPlayers()) do
if Team1Folder:FindFirstChild(Player.Name) then
local PlayerGui = Player:WaitForChild("PlayerGui")
local DisplayGUI = PlayerGui:WaitForChild("Display")
local DisplayText = DisplayGUI:WaitForChild("Display")
DisplayText.Text = Text
elseif Team2Folder:FindFirstChild(Player.Name) then
local PlayerGui = Player:WaitForChild("PlayerGui")
local DisplayGUI = PlayerGui:WaitForChild("Display")
local DisplayText = DisplayGUI:WaitForChild("Display")
DisplayText.Text = Text
end
end
end
local function TrueScore(hit, TeamName,Team1TP, Team2TP, TeamBallValue, Team1Folder, Team2Folder, OOBValue, TimeRunning, Removal, ShotClock, BallTip, Scored, TPBack)
TimeRunning.Value = false
Scored.Value = true
hit.Equip.Disabled = true
FireText("Team"..TeamBallValue.Value.." Scores")
wait(1)
Removal.Value = true
TeamName.Value = TeamName.Value + 2
wait(2)
FireText("")
if TeamName.Value < 22 then
for _, Player in pairs(game.Players:GetPlayers()) do
if Team1Folder:FindFirstChild(Player.Name) then
TeleportPlayers(Player, Team1TP, 16)
elseif Team2Folder:FindFirstChild(Player.Name) then
TeleportPlayers(Player, Team2TP, 16)
end
end
elseif TeamName.Value >= 22 then
for _, Player in pairs(game.Players:GetPlayers()) do
if Team1Folder:FindFirstChild(Player.Name) then
TeleportPlayers(Player, TPBack, 16)
elseif Team2Folder:FindFirstChild(Player.Name) then
TeleportPlayers(Player, TPBack, 16)
end
end
end
Removal.Value = false
Scored.Value = false
ShotClock.Value = 24
TimeRunning.Value = true
wait(1)
if TeamBallValue.Value == 1 then
CloneBall(Team2TP)
elseif TeamBallValue.Value == 2 then
CloneBall(Team1TP)
else
CloneBall(BallTip)
end
end
local function FalseScoring(hit, Name,Team1TP, Team2TP, TeamBallValue, Team1Folder, Team2Folder, OOBValue, TimeRunning, Removal, ShotClock, BallTip, Scored, TPBack)
TimeRunning.Value = false
FireText("False Scoring On "..Name)
hit.Equip.Disabled = true
wait(1)
Removal.Value = true
wait(2)
FireText("")
for _, Player in pairs(game.Players:GetPlayers()) do
if Team1Folder:FindFirstChild(Player.Name) then
TeleportPlayers(Player, Team1TP, 16)
elseif Team2Folder:FindFirstChild(Player.Name) then
TeleportPlayers(Player, Team2TP, 16)
end
end
Removal.Value = false
ShotClock.Value = 24
TimeRunning.Value = true
wait(1)
if TeamBallValue.Value == 1 then
CloneBall(Team2TP)
elseif TeamBallValue.Value == 2 then
CloneBall(Team1TP)
else
CloneBall(BallTip)
end
end
for _, ShootingPart in pairs(ShootingParts) do
ShootingPart.Touched:Connect(function(hit) -- the line that errors
print(ShootingPart.ClassName)
if not ShootDebounce and hit.Parent:IsA("Tool") then
ShootDebounce = true
local CourtValue = hit.Values.CourtValue
if CourtValue.Value ~= "" then
local CourtFolder = workspace:FindFirstChild(CourtValue.Value)
local WallPartsFolder = CourtFolder.WallsPart
local GamePlayers = CourtFolder.GamePlayers
local GameValues = CourtFolder.GameValues
local GameRunning = GameValues.GameRunning
local Team1Folder = GamePlayers.Team1
local Team2Folder = GamePlayers.Team2
local Teleporters = CourtFolder.Teleporters
local Team1Tp = Teleporters.Team1Tp
local Team2Tp = Teleporters.Team2Tp
local TimeRunning = GameValues.TimeRunning
local SCViolation = GameValues.SCViolation
local BallTip = Teleporters.BallTP
local Team1Teleporters = Teleporters.Team1TP
local Team2Teleporters = Teleporters.Team2TP
local ShotClock = GameValues.ShotClock
local TeamBall = GameValues.TeamBall
local Travel = GameValues.Travel
local OOBValue = GameValues.OOB
local Scored = GameValues.Scored
local Removal = GameValues.Removal
local TimerActive = false
local Team1Score = GameValues.Team1Score
local Team2Score = GameValues.Team2Score
local TPBack = CourtFolder.TPBack
local Goals = CourtFolder.Goals
local Team1Goal = Goals:WaitForChild("Team1Goal")
local Team2Goal = Goals:WaitForChild("Team2Goal")
local PadsFolder = CourtFolder:WaitForChild("Pads")
local team1pads = PadsFolder.Team1
local ObjectsFolder = CourtFolder.Objects
local team2pads = PadsFolder.Team2
local Confirm = GameValues:WaitForChild("Confirmed")
local Agree = GameValues:WaitForChild("Agree")
local Refuse = GameValues:WaitForChild("Refuse")
local ScoreDebounce = GameValues.ScoreDebounce
local MaxPlayers = GameValues.MaxPlayers
if OOBValue.Value == false and SCViolation.Value == false
and Travel.Value == false and Scored.Value == false and ShotClock.Value ~= 0 and TimeRunning.Value == true then
if ShootingPart.Name == "Team1Goal" then
if TeamBall.Value == 2 then
ShootDebounce = true
TrueScore(hit, Team2Score, Team1Tp, Team2Tp, TeamBall, Team1Folder, Team2Folder, OOBValue, TimeRunning, Removal, ShotClock, BallTip, Scored, TPBack)
wait(1)
ShootDebounce = false
elseif TeamBall.Value == 1 then
ShootDebounce = true
FalseScoring(hit, hit.Values.BallHandler.Value, Team1Tp, Team2Tp, TeamBall, Team1Folder, Team2Folder, OOBValue, TimeRunning, Removal, ShotClock, BallTip, Scored, TPBack)
wait(1)
ShootDebounce = false
end
elseif ShootingPart.Name == "Team2Goal" then
if TeamBall.Value == 1 then
ShootDebounce = true
TrueScore(hit, Team1Score, Team1Tp, Team2Tp, TeamBall, Team1Folder, Team2Folder, OOBValue, TimeRunning, Removal, ShotClock, BallTip, Scored, TPBack)
wait(1)
ShootDebounce = false
elseif TeamBall.Value == 2 then
ShootDebounce = true
FalseScoring(hit, hit.Values.BallHandler.Value, Team1Tp, Team2Tp, TeamBall, Team1Folder, Team2Folder, OOBValue, TimeRunning, Removal, ShotClock, BallTip, Scored, TPBack)
wait(1)
ShootDebounce = false
end
end
end
end
end
end)
end
end
function ShootingService:Init()
end
return ShootingService
i am trying to achieve that it is so when the ball touches the part it scores but for some reason it still gives me it
Lets go in depth of what i did
1.i did not looped it (did not work)
that’s all i guess
Any Help is Appreciated
Thanks!