Unable to cast value to object

I want to make a datastore script, that reminds the client sided text label to show the current value of money.

But I get the Unable to cast value to object - Line 17.

local DataStore2 = require(1936396537)

game:GetService("Players").PlayerAdded:Connect(function(plr)
	local Money_ = "Money_"
	local MoneyData = DataStore2(Money_, plr)

	wait(2)
	local Money = game.Workspace.ClientValuesToServer.Money.Value

	local success, errorMessage = pcall(function()
		Money = MoneyData:Get() or 2000
		
	end)

	if success then
		print("Data successfully loaded")
		game.Workspace.ClientValuesToServer.MoneyEvent:FireClient(Money) -- 17
	else
		print("There was an error loading the data: " .. errorMessage)
		plr:Kick("Couldnt load data. Initiating Client Kicking. Expierience Error Code: 0x1936396537f")
	end
end)

When you run fire client you have to specify which client, since they are multiple clients

So you have to do :FireClient(Player, Money)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.