Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Server Script:
- local ms = game:GetService("MarketplaceService")
- local gamePassRF = game:GetService("ReplicatedStorage"):WaitForChild("GamePassRF")
- local vipBoughtRE = game:GetService("ReplicatedStorage"):WaitForChild("VipBoughtRE")
- function purchaseDone(player, id, success)
- if success and id == 4604785 then
- vipBoughtRE:FireClient(player)
- end
- end
- function hasPass(player, id)
- return ms:UserOwnsGamePassAsync(player.UserId, id)
- end
- gamePassRF.OnServerInvoke = hasPass
- ms.PromptGamePassPurchaseFinished:Connect(purchaseDone)
- --Local Script:
- local player = game.Players.LocalPlayer
- local button = script.Parent.Frame:WaitForChild("TextButton")
- local gamePassRF = game:GetService("ReplicatedStorage"):WaitForChild("GamePassRF")
- local vipBoughtRE = game:GetService("ReplicatedStorage"):WaitForChild("VipBoughtRE")
- local isSped = false
- local id = 4604785
- local playerHasVIP = gamePassRF:InvokeServer(id)
- function toggleSpeed()
- if player.Character and playerHasVIP then
- if isSped then
- button.Text = "Speed up"
- player.Character.Humanoid.WalkSpeed = 16
- isSped = false
- else
- button.Text = "Slow down"
- player.Character.Humanoid.WalkSpeed = 30
- isSped = true
- end
- else
- if not playerHasVIP then
- game:GetService("MarketplaceService"):PromptGamePassPurchase(player, id)
- end
- end
- end
- function purchased()
- playerHasVIP = true
- end
- vipBoughtRE.OnClientEvent:Connect(purchased)
- button.MouseButton1Click:Connect(toggleSpeed)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement