Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Transfering data to a other script not working?

Hello I made a script for a shop with a PurchaseHandler and the data transfer over the remotefunction isn't working it says then: "PlayerScripts are not a valid Member of Player" but my name is LazyTfftALT so it isn't working or on Cash it says then Cash not the transfered Value how do I fix it.

The Progressor:

script.Parent.MouseButton1Click:Connect(function(player)
	local Coinst = 1000
	local Cash = 1000
	
	local player = game.Players.LocalPlayer
	if player.PlayerScripts.Coins.Value >= Coinst then
		script.Parent.Text = "Progressing"
		
		print("invoked")
		game.Workspace.PurchaseHandler.DataHandler:InvokeServer(player,Coinst,Cash)
		print("e")
		wait(1)
		script.Parent.Text = "Bought!"
		wait(2)
		script.Parent.Text = "1k Cash - 1000 Coins"
	else
		script.Parent.Text = "You don't have enough Coins!"
		wait(3)
		script.Parent.Text = "1k Cash - 1000 Coins"
	end
end)

And here the Purchase Handler:

script.DataHandler.OnServerInvoke = function(player,Coinst,Cash)
	local plr = player:WaitForChild("Coins")
	plr.Value = plr.Value -Coinst
	local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
			if cashmoney then
				cashmoney.Value = cashmoney.Value + Cash
			end
end

1 answer

You cannot achieve PlayerScripts from the Server with FilteringEnabled... I had the same problem...

Try putting the Coins Value into the ReplicatedStorage

This discussion is preserved as it was. New answers, comments, and votes are closed.