So, I am trying to send a module’s function to client
this is the module I am trying to send
in the serverScripts.
and this is the part I am trying to send
I want to send data of Rewards.Coins to client using FireClient
and lastly the client script which should recieve the data from server
-Rewards Module script
local ServerScriptService = game:GetService("ServerScriptService")
local StatsModule = require(ServerScriptService:WaitForChild("Stats"))
local Rewards = {}
function Rewards.strength(player, Amounth, UseMultiplier)
UseMultiplier = if UseMultiplier ~= nil then UseMultiplier else true
local Rankmultiplier = if UseMultiplier == true then StatsModule.StrengthMultiplier(player) else 1
player.leaderstats.Strength.Value += Amounth * Rankmultiplier
print(Amounth,Rankmultiplier,Amounth*Rankmultiplier)
end
function Rewards.Coins(player, Amounth, UseMultiplier)
UseMultiplier = if UseMultiplier ~= nil then UseMultiplier else true
local Rankmultiplier = if UseMultiplier == true then StatsModule.CoinMultiplier(player) else 1
player.leaderstats.Coins.Value += Amounth * Rankmultiplier
end
return Rewards
– script to send the data
ScriptableFolder.Sell.Touched:Connect(function(hit)
local player = players:GetPlayerFromCharacter(hit.Parent)
if player then
local Strength = player.leaderstats.Strength.Value
if Strength >0 then
Rewards.Coins(player,Strength,true)
player.leaderstats.Strength.Value = 0
remotes.SellEventTextRemotes:FireClient(player)
end
end
end)
-Local script
-- remotes.SellEventTextRemotes.OnClientEvent:Connect(function(Rewards.Coins)
--warn("Client got data from activating a tool:", Stat)
local TweenService = game:GetService("TweenService")
local SellCoinsClone1 = SellCoins1:Clone()
local SellCoinsClone2 = SellCoins2:Clone()
local SellCoinsClone3 = SellCoins3:Clone()
local SellCoinsClone4 = SellCoins4:Clone()
local SellCoinsClone5 = SellCoins5:Clone()
local Info = TweenInfo.new(3)
local Tween = game:GetService("TweenService"):Create(SellCoins1,Info,{TextTransparency=1})
Tween:Play()
SellCoins1.Parent= script.Parent
SellCoins1.Visible = true
SellCoins1.Text = "+"..tostring()
SellCoins1.Position = GetRandomPosition()
local newPos = SellCoins1.Position + UDim2.fromScale(0,-0.4)
SellCoins1:TweenPosition(newPos,"In","Quad",1,false)
SellCoins1.Rotation = math.random(-15,0)
print("welp")
wait(3)
SellCoins1:Destroy()
end)