0

# This script for my DevProduct gui works fine in studio, but not in-game. What's wrong with it?

Asked by 3 years ago
Edited 3 years ago

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...

In studio

In a server

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

0
Things take time to load, check that all of the text buttons have events connected.. User#5423 -10 — 3y
0
k thx rodrigo455 578 — 3y
0
Error:scripts cannot read your mind. hiimgoodpack 2009 — 3y
0
Apparently they can in studio :P rodrigo455 578 — 3y