Hi!
So I’m trying to add a Premium benefit for players if they play my game. It’s just a simple speed boost that’s 4 times the default WalkSpeed. The sprint toggle is an ImageButton within a ScreenGUI. In my code, I check if the player owns Premium, then if they do, I make the button visible to them so they can use it.
Since I don’t have Premium, I added a Premium Purchase Modal in my game and “bought” it while I was testing. After I “bought” Premium, the button did not show up. I tried resetting my character, but no luck.
Here’s the code, located in a Script within the ServerScriptService:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
if player.MembershipType == Enum.MembershipType.Premium then
game.StarterGui.premiumbenefits.walkspeed.Visible = true -- "premiumbenefits" is the name of the ScreenGUI, and "walkspeed" is the name of the ImageButton.
end
end)
Thank you for reading - any ideas as to what might be causing the problem?
Edit: Grammar mistake, sorry 'bout that!