Self-explanatory title, no errors, it just doesn’t clone into it for some reason. Any help would be greatly appreciated!
local MarketplaceService = game:GetService("MarketplaceService")
local button = script.Parent
local player = game.Players.LocalPlayer
local gamepassId = (TEST PASS ID HERE)
local ClickSound = script.Parent.ClickSound
local tool = game.ReplicatedStorage:WaitForChild("GravityCoil")
button.MouseButton1Click:connect(function()
if player then
ClickSound:Play()
MarketplaceService:PromptGamePassPurchase(player, gamepassId)
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, gamepassId, wasPurchased)
if wasPurchased then
print("Purchase successful!")
local ToolClone = tool:Clone()
ToolClone.Parent = player:WaitForChild("StaterGear")
end
end)
end
end)
Make a RemoteEvent in ReplicatedStorage call it Give
Make a Script in ServerScriptService call it whatever u want
Fire the server like this:
LOCAL SCRIPT: --this is inside ur GUI
local ToolName = "ToolNameHere"
local ReplicatedStorage= game:GetService("ReplicatedStorage")
ReplicatedStorage.Give:FireServer(ToolName)
SCRIPT: --this is inside ServerScriptService
local event = game:GetService("ReplicatedStorage").Give
event.OnServerEvent:Connect(function(plr, toolname)
if game.ReplicatedStorage:FindFirstChild(toolname) then
local clone = game.ReplicatedStorage[toolname]:Clone()
clone.Parent = plr.StarterGear
else
warn("No tool found called:",toolname)
end
end)