local event = game.ReplicatedStorage.RocketAdder
local ms = game:GetService(âMarketplaceServiceâ)
local gamepassId = 18261191
event.OnServerEvent:Connect(function(player)
local Character = player.Character
if ms:UserOwnsGamePassAsync(player.UserId, gamepassId) then
print(âUser owns gamepass!â)
for i = 0, 1,1 do
local Part = Instance.new(âPartâ)
Part.Shape = Enum.PartType.Cylinder
Part.Size = Vector3.new(30,17,24)
Part.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-5)
Part.Parent = workspace
end
end
end)
Hey, just wanted to leave some code because I played with that a bit.
local event = game.ReplicatedStorage.RocketAdder
local ms = game:GetService("MarketplaceService")
local gamepassId = 18261191
local playerTab = {}
local function SpawnPart(cframe)
local Part = Instance.new("Part")
Part.Anchored = true
Part.Size = Vector3.new(5,5,5)
Part.CFrame = cframe
Part.Parent = workspace
end
event.OnServerEvent:Connect(function(player)
local char = player.Character
if char then
local hum = char:FindFirstChildOfClass("Humanoid")
local root = char:FindFirstChild("HumanoidRootPart")
if char and root then
if playerTab[player.UserId] == nil then
playerTab[player.UserId] = 1
else
playerTab[player.UserId] += 1
end
if ms:UserOwnsGamePassAsync(player.UserId, gamepassId) then
print("User owns gamepass!")
if playerTab[player.UserId] <= 5 then
SpawnPart(root.CFrame * CFrame.new(root.CFrame.lookVector * 3))
else
print("Player is over the limit!")
end
else
print("User doesn't own the gamepass.")
if playerTab[player.UserId] <= 3 then
SpawnPart(root.CFrame * CFrame.new(root.CFrame.lookVector * 3))
else
print("Player is over the limit!")
end
end
end
end
end)
Hope it helps
So the gamepass isnât functional then?
Should work.
[Char_Limitttttt]
Nope, never programmed it. (ee)
Well, have you tried the one that [adammada112] sent?
Cool! I just cant seem to make it work. Do I need something in replicated storage?
Here is some reference that should help you to better understand gamepasses also:
And yeah, you need the remote event in Replicated Storage. And please, take a look at my code and try to play with it too a bit, just donât copy and paste it not knowing what itâs doing. If you donât understand something, for example, CFrame.lookVector, search in the api reference.
Ok. I will see, I just am losing confidence in this project as I cant seem to learn much off this.
Well, you in fact can learn a lot, its just about your motivation, If you want to simply copypaste my code, you can. But, if youâll try to understand it, using the api reference and devforum, you will definitely make some progress. Itâs just about, do you really want to understand? You have to start from the basics also.
Well I was in your code, and when I try it out I get this error: OnServerEvent can only be used on the server
Of course. You have to put the script into ServerScriptService. Do you have understanding of remote events? If not, you can either search in the api or watch this video hope that helps.
I did put it there. and it dosent work.
Can you show me your Explorer so I can see the possible error?
This seems fine to me. What particullarly is the error? Also, send it privately to me , so we donât take space here.
pie?? are u gonna revive the space game?