So I’m having a problem where this script won’t work correctly
for i,v in game.CollectionService:GetTagged("Shop") do
if v:IsA("TextButton") then
v.MouseButton1Click:Connect(function()
game.ReplicatedStorage.market:FireServer(v.Name)
end)
end
end
The collection function runs but the MouseClick function doesn’t run when It’s supposed to.
Hmm, try printing the name of the textbutton to see if it actually gets it:
for i,v in game.CollectionService:GetTagged("Shop") do
if v:IsA("TextButton") then
print(v.Name)
v.MouseButton1Click:Connect(function()
game.ReplicatedStorage.market:FireServer(v.Name)
end)
end
end
Also consider using V.Activated:Connect() instead of V.MouseButton1Click:Connect(), activated works for just about every device (not sure about console though)
Still not working. It does return all of the text buttons. I tried activated. Didn’t work either. In console there are no errors. The function just isn’t running.
There are multiple thats why its collection service. But here is one of them. All of them are the same properties but they just have different names and text
Ok wait I just realized the problem I think, the reason it is printing the things name is due to how roblox is, for whatever reason tags wont be cloned along with Instances, what it is printing is the textButtons inside of starterGui, and not the players UI, cause well, again, cause they dont get cloned with them.
To make sure I am right, what I want you to do is:
Playtest → Players → YourPlayerInstance → PlayerGui → Your UI → One of the buttons → tags:
Tags is in the properties, if its empty please tell forth lol
First off, if there is a button unlocking the mouse, then make the zindex 0, otherwise, just make the button zindex like 22 just to test, also just a question, do u use context action service that uses mouse button 1 up or something like that?