Basically I am trying to figure out the code to put in the event listener
This one is the code that I made with some help to detect the player touch
local debounce = false
local GroupID = 5033016
local GEV = game.Workspace.DetectorEvent
Alfa.Touched:Connect(function(hit)
if debounce then return end
if game.Players:GetPlayerFromCharacter(hit.Parent) then
debounce = true
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
print(player.Name)
if player:IsInGroup(GroupID) then
print(player.Name.. " Is In Group")
GEV:Fire()
end
end
wait(2)
debounce = false
end)```
Now this one is the event listener that I want to figure out if I need to do the whole script again to work or if I do something different.
```local EV = game.Workspace:WaitForChild("BindableEvent")
EV.Event:Connect(function()
--I know that the script goes here but I need to do the whole script again?
end)```
Oh, I think you mean the variables, if you have to write them again. When using :Fire(), you can set in values inside the brackets as it accepts a tuple.
The .Event listener’s function arguments will include the tuple in respective order from :Fire(). Therefore if you want to pass some variables into the event, do it.
Reviewing the code here, I can see that the if statements already filtered the outputs. Only players that is in group will fire the event and do not require a second if statement.