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 Bunny, it fires a remote event to the client where it will reward the player for finding the Bunny. But now when I Fire the client it gives me an error saying ServerScriptService.BunnyHandler.MainBunny:35: attempt to concatenate string with nil How Do I fix this?
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 ReplicatedCore = require(ReplicatedStorage:WaitForChild('Core'))
local ReplicatedData = ReplicatedCore.ReplicatedData
local ServerService = game:GetService('ServerStorage')
local ServerCore = require(ServerService:WaitForChild('Core'))
local BunnyTouchedEvent = RemoteModule:GetRemote('BunnyTouched', 'RemoteEvent', false)
local Module = {}
function Module:CheckBunny(bunnyID)
for i, Bunny in pairs(BunnyFolder:GetChildren()) do
if Bunny:IsA('Part') and Bunny.Parent == BunnyFolder then
Bunny.Touched:Connect(function(Hit)
local LocalPlayer = Players:GetPlayerFromCharacter(Hit.Parent)
local profile = ServerCore.DataService:GetPlayerProfile(LocalPlayer)
if not profile then
warn('No Player Profile!')
return
end
local BunnyConfig = ReplicatedModules.Bunnys:GetItemConfig(bunnyID)
if not BunnyConfig then
warn('No Item Config For' ..bunnyID)
return
end
BunnyTouchedEvent:FireClient(LocalPlayer, Bunny)
table.insert(profile.Data.BunniesFound, bunnyID)
print('Bunny Was Touched')
end)
else
warn('Touched Part Not From Bunny Folder')
end
end
end
return Module