Hello! I am Dev_Asher and I am working on a find the markers game remake, I made a script where when the player touched a marker or in this case a Bunny, it fires a remote event to the client where it will reward the player for finding the Bunny.
here is the script
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local Players = game:GetService('Players')
local BunnyFolder = workspace:WaitForChild('BunnysFolder')
local ReplicatedModules = require(ReplicatedStorage:WaitForChild('Modules'))
local RemoteModule = ReplicatedModules.RemoteService
local BunnysModule = ReplicatedModules.Bunnys
local SystemsContainer = { }
local Debounce = { }
local BunnyTouchedEvent : RemoteEvent = RemoteModule:GetRemote('BunnyTouched', 'RemoteEvent', false)
local selectedData = nil
local Module = {}
function Module:BunnyStack(BunnyID)
return {
ID = BunnyID,
UUID = HTTPService:GenerateGUID(false)
}
end
local DB = false
function Module:CheckBunnyFromID(BunnyID, BunnyName)
for i, Bunny in pairs(BunnyFolder:GetChildren()) do
if Bunny:IsA('Part') and Bunny.Parent == BunnyFolder then
Bunny.Touched:Connect(function(Hit)
if DB == false then DB = true
local LocalPlayer = Players:GetPlayerFromCharacter(Hit.Parent)
local Interface = LocalPlayer:WaitForChild('PlayerGui'):WaitForChild('Ui_Interface')
local FoundBunnyUI = Interface:WaitForChild('BunnyFound')
local LHUD = Interface:WaitForChild('LHUD')
BunnyTouchedEvent:FireClient(LocalPlayer, Bunny)
DB = false
end
end)
else
warn('Touched Part Not From Bunny Folder')
end
end
end
function Module:Init(otherSystems)
SystemsContainer = otherSystems
end
return Module