Data is always nil

  1. What do you want to achieve? Keep it simple and clear!
    To get the players data.

The data store script is the one used in the gnome code tower defences series.
2. What is the issue? Include screenshots / videos if possible!
The data is always nil no matter what.
3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have switched to the client and used a remote function to return the data from the data store script.

local data = game:GetService("ReplicatedStorage"):WaitForChild("GetData"):InvokeServer(game.Players.LocalPlayer)

function Trade(player1 : Player, player2 : Player)
	print("FUNCTION CALLED!")
	local GUI = player1.PlayerGui:WaitForChild("Trade")
	print("GUI FOUND!")
	GUI.Trading_Frame.Visible = true
	print("GUI FRAME IS VISIBLE")
	print(data)
	for i,v in pairs(data) do
		if game:GetService("ReplicatedStorage"):FindFirstChild(v) then
			local Tower = game:GetService("ReplicatedStorage"):FindFirstChild(v)
			local clone = GUI.Trading_Frame.Player_1.Template:Clone()
			print(v)
			clone.Parent = GUI.Trading_Frame.Player_1
			clone.ImageLabel.Image = Tower.Config.Image.Texture
			clone.Name = Tower.Name
		else
			warn(`Requested tower {v.Name} Doesnt exist.`)
		end
	end
end

local player = game.Players.LocalPlayer

Trade(player,player) 

The data isnt nil as it works everywhere else so i dont know why its not working here when i used the same method for this as i did everywhere else.

Ended up solving it my self.

Char limit

AAAAAAAA

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