local MPS = game:GetService('MarketplaceService')
local player = game.Players.LocalPlayer
local UI = player:WaitForChild('PlayerGui').UI
local marketID = UI:WaitForChild('GamepassFrame').BuyBtn.BuyBtnScript.ID
local descText = UI:WaitForChild('GamepassFrame').DescriptionText.Text
local flashID = 18604915
local medKitID = 18637848
if descText == '*Clicks* Use this to light the day!' then
marketID.Value = flashID
elseif descText == 'Heals you to 75 percent of your health! Note: *ONE USE PER RESPAWN*' then
marketID.Value = medKitID
end
script.Parent.MouseButton1Click:Connect(function()
MPS:PromptGamePassPurchase(player, marketID.Value)
end)
This is my Local Script. I am trying to change the Number Value when the description is a certain test, but the id refuses to change. Any help?
i’m assuming because if you’re referencing IDs from ROBLOX library in creations, you’ll have to do some sort of rbxassetid thing.
This is a gamepass ID, not an asset.
… oh, well i’ve done what i can do but see if there’s anything like rbxassetid:// or if there’s anything that’ll change the values, i can’t be sure unfortunately since that’s like the only thing i would think of
I’m assuming you want it to change the ID when the player clicks on a “buy” button, right?
I change the ID as soon as the player touches another frame, which would change the description text
Touches another frame?
how are you checking if the player touches the other frame, cause I don’t see an event connection here
No, it is a TextButton. The player presses it and the description changes it value.
local MPS = game:GetService('MarketplaceService')
local player = game.Players.LocalPlayer
local UI = player:WaitForChild('PlayerGui').UI
local marketID = UI:WaitForChild('GamepassFrame').BuyBtn.BuyBtnScript.ID
local descText = UI:WaitForChild('GamepassFrame').DescriptionText.Text
local flashID = 18604915
local medKitID = 18637848
script.Parent.MouseButton1Click:Connect(function()
if descText == '*Clicks* Use this to light the day!' then
marketID.Value = flashID
elseif descText == 'Heals you to 75 percent of your health! Note: *ONE USE PER RESPAWN*' then
marketID.Value = medKitID
end
MPS:PromptGamePassPurchase(player, marketID.Value)
end)
Here! This should work better!
I believe the script changes the value only at the start, but it doesn’t change the value when the button is clicked cause it’s outside the event connection, so the above script should hopefully work for you!
oops, can you check for errors on the output?
None. If I was to set the value of the Int to nothing, it returns errors saying that :PromptGamePurchase value cant be nil.
local player = game.Players.LocalPlayer
local UI = player:WaitForChild('PlayerGui').UI
local marketID = UI:WaitForChild('GamepassFrame').BuyBtn.BuyBtnScript.ID
local descText = UI:WaitForChild('GamepassFrame').DescriptionText.Text
local flashID = 18604915
local medKitID = 18637848
script.Parent.MouseButton1Click:Connect(function()
local descText = UI:WaitForChild('GamepassFrame').DescriptionText.Text
print(descText)
if descText == '*Clicks* Use this to light the day!' then
marketID.Value = flashID
elseif descText == 'Heals you to 75 percent of your health! Note: *ONE USE PER RESPAWN*' then
marketID.Value = medKitID
end
MPS:PromptGamePassPurchase(player, marketID.Value)
end)
Can you try this one? Hopefully we can find the mistake
1 Like
it works now lol. I dont know how but thanks :))
I just forgot to tell you that when you make a variable it stores the values and doesn’t change from time to time, so that was our problem