#Donation Jar bug

1 messages · Page 1 of 1 (latest)

steady hollow
#

Everything is done and made but it loads pefectly fine in studio and when i test it inside the game though it doesn't load anything up

patent cosmos
#

can't do anything without the code pal

#

It can be anything from the fact that the server has to be hosted locally for some reason to the certain enabling plugins to code specifying that it has to be run in studio

could be other things too, like maybe you forgot to update your game

low egret
steady hollow
#

its scripted my by myself and my friend, theres 2 server scripts 1 is a module and anothers a script, then a local script inside a screen ui and a local scritp in starterplayer

low egret
#

I would like to see some code if you want help.

steady hollow
#

AssetServer(script in SSS)

local MarketplaceService = game:GetService("MarketplaceService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AssetManager = require(script.Parent:WaitForChild("AssetManager"))

local GetPlayerAssets = ReplicatedStorage:FindFirstChild("GetPlayerAssets") or Instance.new("RemoteFunction")
GetPlayerAssets.Name = "GetPlayerAssets"
GetPlayerAssets.Parent = ReplicatedStorage

GetPlayerAssets.OnServerInvoke = function(player, targetUserId, assetId, assetType)
if assetId and assetType == "Gamepass" then
local success, err = pcall(function()
MarketplaceService:PromptGamePassPurchase(player, assetId)
end)
return success
end

if not targetUserId then
    targetUserId = player.UserId
end

if typeof(targetUserId) ~= "number" then
    return {}
end

local success, assets = pcall(function()
    local result = AssetManager:GetUserGamepasses(targetUserId)
    return result or {}
end)

if success then
    return assets
else
    return {}
end

end

local OpenDonateGui = ReplicatedStorage:FindFirstChild("OpenDonateGui") or Instance.new("RemoteEvent")
OpenDonateGui.Name = "OpenDonateGui"
OpenDonateGui.Parent = ReplicatedStorage

local RequestOpenDonateGui = ReplicatedStorage:FindFirstChild("RequestOpenDonateGui") or Instance.new("RemoteEvent")
RequestOpenDonateGui.Name = "RequestOpenDonateGui"
RequestOpenDonateGui.Parent = ReplicatedStorage

RequestOpenDonateGui.OnServerEvent:Connect(function(player, targetUserId)
if typeof(targetUserId) == "number" then
OpenDonateGui:FireClient(player, targetUserId)
end
end)

#

----------------

#

ignore the # part it was to big 💀

#

----------

#

Script inside tool in server straoge:

local prompt = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

prompt.Triggered:Connect(function(player)
local tool = script.Parent
local maxDepth = 5
local depth = 0
while tool and tool.Parent and tool.Name ~= "TipsJAR" and depth < maxDepth do
tool = tool.Parent
depth = depth + 1
end
local holderPlayer = nil

if tool and tool:IsA("Tool") and tool.Name == "TipsJAR" then
    holderPlayer = tool.Parent and Players:GetPlayerFromCharacter(tool.Parent)
else
    holderPlayer = player
end

local remoteEvent = ReplicatedStorage:WaitForChild("OpenDonateGui")
remoteEvent:FireClient(player, holderPlayer.UserId)

end)

#

Starterplayer script local

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local donationGui = playerGui:WaitForChild("Donate")
local mainFrame = donationGui:WaitForChild("MainFrame")

local RequestOpenDonateGui = ReplicatedStorage:WaitForChild("RequestOpenDonateGui")
local OpenDonateGui = ReplicatedStorage:WaitForChild("OpenDonateGui")

OpenDonateGui.OnClientEvent:Connect(function(targetUserId)
player:SetAttribute("DonateTargetUserId", targetUserId)
mainFrame.Visible = true
end)

local function onTargetPlayerClicked(targetPlayer)
if targetPlayer and targetPlayer ~= player then
RequestOpenDonateGui:FireServer(targetPlayer.UserId)
end
end

local function setupClickForPlayer(targetPlayer)
if targetPlayer.Character then
local head = targetPlayer.Character:FindFirstChild("Head")
if head then
local clickDetector = head:FindFirstChildOfClass("ClickDetector")
if not clickDetector then
clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = head
end
clickDetector.MouseClick:Connect(function(clickedPlayer)
if clickedPlayer == player then
onTargetPlayerClicked(targetPlayer)
end
end)
end
end
end

for _, plr in pairs(Players:GetPlayers()) do
if plr ~= player then
setupClickForPlayer(plr)
end
end

Players.PlayerAdded:Connect(function(plr)
if plr ~= player then
plr.CharacterAdded:Connect(function()
setupClickForPlayer(plr)
end)
end
end)

steady hollow
#

@low egret @patent cosmos

steady hollow
#

AHEM

patent cosmos
#

not reading allat

#

if you have a specific bug you want to look at then I will oblige

steady hollow
patent cosmos
#

in any case, debugging is good

#

🙂

steady hollow