this is just a script! i want it so that it would work for local script, btw would it still work in local script?
yeah it should work in a local script, just put the local button script under StarterPlayer.StarterPlayerScripts
hey can you tell me what is the diffrence between charather and player script, i have made some scripts in characters too?
In regards to my previous instructions which was assuming it was server to server communication
New Way:
- Insert a RemoteEvent called âFinishedPlayerSetupâ (Delete the old bindable event if you still have it)
- Reference the event in the PlayerLoading script
- In the player loading script insert this line at this point
leaderstats.Parent = plr
FinishedPlayerSetup:FireClient(plr) -- Insert this line here at line 331
remotevent:FireClient(plr, true)
- In the local ButtonScript reference the same event
- At the bottom of the ButtonScript insert this in replacement of the player added event (or the old bindable event connection)
FinishedPlayerSetup.OnClientEvent:Connect(buttonvalue)
I believe that StarterPlayerScripts load scripts into the player once they have started the game whilst StarterCharacterScripts load scripts into the character once they have started the game.
Hmm Technically i did not understand anything lol!
I recommend checking out the roblox documentations
Did the previous code instructions I sent work?
well i am trying to fix the code so it can work on the local
hmm, I believe the only thing you would have to change is writing
local player = game.Players.LocalPlayer
oh and also remove the player parameter in the buttonvalue function and also the âif player thenâ line
well it worked Thanks for the help also i have another problem!,
so i am trying to Do the Vip! b ut the problem is that it does not work out!
-- Gives the player vip
productFunctions[259204857] = function(receipt, player)
local vip = player:WaitForChild("VIP")
local gamepassvip = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId , VIP)
if gamepassvip then
if vip then
player.VIP.Value = true
player.PlayerGui.ScreenGui.Purchasesucessfull.Visible = true
end
end
end
local function processReceipt(receiptInfo)
local userId = receiptInfo.PlayerId
local productId = receiptInfo.ProductId
local player = Players:GetPlayerByUserId(userId)
if player then
-- Get the handler function associated with the developer product ID and attempt to run it
local handler = productFunctions[productId]
local success, result = pcall(handler, receiptInfo, player)
if success then
-- The user has received their benefits!
-- return PurchaseGranted to confirm the transaction.
player.PlayerGui.ScreenGui.Purchasesucessfull.Visible = true
return Enum.ProductPurchaseDecision.PurchaseGranted
else
warn("Failed to process receipt:", receiptInfo, result)
end
end
end
Marketplaceservice.ProcessReceipt = processReceipt
if you can then you can resolve this issue!
no problem, happy to help! good luck in your developing journey!
Of course !
Didnât realize this was supposed to be local originally so my apologies.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.