Why LocalScript doesn't work for anyone else in the game?

Hi, so I made a LocalScript which is this

local MPS = game:GetService("MarketplaceService")

game.ReplicatedStorage.AddButton.OnClientEvent:Connect(function()
	for i, button in pairs(workspace:GetDescendants()) do
		if button:IsA("TextButton") then
			print(button.Name)
			button.MouseButton1Down:Connect(function()
				print("Clicked")
				MPS:PromptPurchase(game.Players.LocalPlayer, button:GetAttribute("Id"))
			end)
		end
	end
end)


workspace.DescendantAdded:Connect(function(des)
	if des:IsA("TextButton") then
		print(des.Name)
		des.MouseButton1Down:Connect(function()
			print("Clicked")
			MPS:PromptPurchase(game.Players.LocalPlayer, des:GetAttribute("Id"))
		end)
	end
end)
--MPS:PromptPurchase(game.Players.LocalPlayer, child:GetAttribute("Id"))

The biggest problem I’m facing is that this script only works for me, I mean the MouseButton1Down event. Why this doesn’t work for any player rather than me? Everytime I click the button, it prints. But when another player does, nothing happens.
Is this a bug or something in my script?
Thanks.

1 Like

We either need more context like where the local script is etc etc. but for now all i cant try to help you with is trying ti change MouseButton1Down to MouseButton1Click, try that

The code seems fine tho, are the other players playing on a different console?

It is located inside StarterPlayerScripts. I think it is the correct place.

I actually tested with different devices from my alt and my friends also did. Just for me, LocalScript worked, but for them, nothing. They even showed me their console.

I’ve already tried it. It works, but when I play from mobile, so when I touch the button, it just sometime gets the touch and sometimes not. If I press hard, then it gets touch in one try.