Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Wiscript 622 Moderation Voter
7 years ago
Edited 7 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:

01for i,v in pairs(script.Parent:GetChildren()) do
02    local player = game.Players.LocalPlayer
03    if v:IsA("TextButton") then
04        v.MouseEnter:connect(function()
05            v:TweenPosition(UDim2.new(1,-200,v.Position.Y.Scale,v.Position.Y.Offset),'In','Sine',0.3,true)
06        end)
07        v.MouseLeave:connect(function()
08            v:TweenPosition(UDim2.new(1,-50,v.Position.Y.Scale,v.Position.Y.Offset),'In','Sine',0.3,true)
09        end)
10        v.MouseButton1Click:connect(function()
11            game.MarketplaceService:PromptProductPurchase(player,tonumber(v.Name))
12        end)
13    end
14end

I also tried this:

01for i,v in pairs(script.Parent:GetChildren()) do
02    local player = game.Players.LocalPlayer
03    if v:IsA("TextButton") then
04        v.MouseEnter:connect(function()
05            v:TweenPosition(UDim2.new(1,-200,v.Position.Y.Scale,v.Position.Y.Offset),'In','Sine',0.3,true)
06        end)
07        v.MouseLeave:connect(function()
08            v:TweenPosition(UDim2.new(1,-50,v.Position.Y.Scale,v.Position.Y.Offset),'In','Sine',0.3,true)
09        end)
10        v.MouseButton1Click:connect(function()
11            game.MarketplaceService:PromptProductPurchase(player,tonumber(v.Name))
12        end)
13    end
14end

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 17 — 7y
0
k thx Wiscript 622 — 7y
0
Error:scripts cannot read your mind. hiimgoodpack 2009 — 7y
0
Apparently they can in studio :P Wiscript 622 — 7y

Answer this question