So, basically. This is just supposed to be a simple to use DevProduct gui. The player gets a gui, places it in the Y position they want and the script will do the rest. Anyway, the script works well in studio, however when I test it in game, it only works for the first one.
Here is what happens...
Anyway, without any further due, here's the script:
for i,v in pairs(script.Parent:GetChildren()) do
local player = game.Players.LocalPlayer
if v:IsA("TextButton") then
v.MouseEnter:connect(function()
v:TweenPosition(UDim2.new(1,-200,v.Position.Y.Scale,v.Position.Y.Offset),'In','Sine',0.3,true)
end)
v.MouseLeave:connect(function()
v:TweenPosition(UDim2.new(1,-50,v.Position.Y.Scale,v.Position.Y.Offset),'In','Sine',0.3,true)
end)
v.MouseButton1Click:connect(function()
game.MarketplaceService:PromptProductPurchase(player,tonumber(v.Name))
end)
end
end
I also tried this:
for i,v in pairs(script.Parent:GetChildren()) do
local player = game.Players.LocalPlayer
if v:IsA("TextButton") then
v.MouseEnter:connect(function()
v:TweenPosition(UDim2.new(1,-200,v.Position.Y.Scale,v.Position.Y.Offset),'In','Sine',0.3,true)
end)
v.MouseLeave:connect(function()
v:TweenPosition(UDim2.new(1,-50,v.Position.Y.Scale,v.Position.Y.Offset),'In','Sine',0.3,true)
end)
v.MouseButton1Click:connect(function()
game.MarketplaceService:PromptProductPurchase(player,tonumber(v.Name))
end)
end
end
But I still got the same result.
Thanks, Rodrigo455

4 comments
Things take time to load, check that all of the text buttons have events connected..
k thx
Error:scripts cannot read your mind.
Apparently they can in studio :P