Getting the error: FireClient: player argument must be a Player object please help

Where should I put the bunny module script

A module script is used to be called by server scripts and local scripts. Use a server script to detect when the bunny is touched. Fire that player to the client with a remote event. Then use a local script to listen to when the remote event is fired with the OnClientEvent event.

You can put it under the serverscript.

Ok wait ServerScriptService? or the server script that rewards the player

Server script. Not the service.

ok The do i put the server script that rewards the player in SeverScriptservice if not where?

You can put the Server Script that rewards the player in ServerScriptService.

Yup, local scripts only work in the starter player and start character scripts folders. Server scripts only work in the workspace and the server script service.

Edit: they also work in other places that I forgot to say

Thanks i will test it out and respond if there is any more errors

2 Likes

create new script in ServerScriptService, and after this put this script:

local ReplicatedService = game:GetService('ReplicatedStorage')
local Players = game:GetService('Players')

local BunnyFolder = workspace:WaitForChild('BunnysFolder')

local ReplicatedModules = ReplicatedService:WaitForChild('Modules')
local BunnyRarityModule = ReplicatedModules.Bunnys

local CHANGENAMEIFUWANT = set here your remote event/Function

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)
			CHANGENAMEIFUWANT:FireClient(LocalPlayer, Bunny)
		end)
	else
		warn('Touched Part Not From Bunny Folder')
	end
end

now, create local script in StartePlayerScripts and after that put to local script this:

local CHANGENAMEIFUWANT = set here your remote event/Function

CHANGENAMEIFUWANT.OnClientEvent:Connect(function(Bunny)
	blah blah blah
    blah blah
end)
1 Like