Need Help with Frame Claiming Script – It Updates Client-Side but Not Server-Side

  1. What do you want to achieve?
    I want to create a script that allows players to claim frames in the game. Once claimed, the frame should update with the player’s image and username, and the frame’s availability should change to “unavailable.”

  2. What is the issue?
    The script updates the frames correctly on the client side (image, username, and availability status), but the changes do not reflect on the server side. When a player claims a frame, it works as expected on the client, but the frame availability and updates aren’t properly applied server-side.

  3. What solutions have you tried so far?

  • I’ve checked that the remoteEvent is fired correctly from the client to the server.
  • I’ve used :WaitForChild for each frame component to ensure they’re properly loaded.
  • I’ve confirmed that the frame updates properly on the client side, but the server doesn’t seem to register the changes.
  • I’ve tried using the :GetChildren() method to check that the frame children are present on the server.

More details:

Here is the full code I’m using:

local framesFolder = workspace:WaitForChild("Frames")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local remoteEvent = Instance.new("RemoteEvent")
remoteEvent.Name = "ClaimFrameEvent"
remoteEvent.Parent = ReplicatedStorage

local function initializeFrameAvailability()
	for _, frame in ipairs(framesFolder:GetChildren()) do
		local config = frame:FindFirstChild("AvailabilityConfig")
		if config then
			local available = config:FindFirstChild("Available")
			local unavailable = config:FindFirstChild("Unavailable")
			if available and unavailable then
				available.Value = true
				unavailable.Value = false

				local availabilityStatus = frame:WaitForChild("AvailabilityStatus")
				availabilityStatus.Color = Color3.fromRGB(127, 255, 92)
			end
		end
	end
end

local function claimFrame(player, imageID, username)
	if not tonumber(imageID) then
		return
	end

	if typeof(username) ~= "string" or #username > 50 then
		return
	end

	local allFrames = framesFolder:GetChildren()

	local selectedFrame
	for _, frame in ipairs(allFrames) do
		local config = frame:FindFirstChild("AvailabilityConfig")
		if config then
			local available = config:FindFirstChild("Available")
			if available and available.Value then
				selectedFrame = frame
				break
			end
		end
	end

	if not selectedFrame then
		return
	end

	local config = selectedFrame:WaitForChild("AvailabilityConfig")
	local available = config:WaitForChild("Available")
	local unavailable = config:WaitForChild("Unavailable")
	available.Value = false
	unavailable.Value = true

	local artistCard = selectedFrame:WaitForChild("ArtistCard")
	local surfaceGui = artistCard:WaitForChild("SurfaceGui")
	local primaryFrame = surfaceGui:WaitForChild("PrimaryFrame")
	local artistUsernameLabel = primaryFrame:WaitForChild("Artist'sUsernameLabel")

	artistUsernameLabel.Text = "By: @" .. username

	local canvasBoard = selectedFrame:WaitForChild("CanvasBoard")
	local canvasGui = canvasBoard:WaitForChild("SurfaceGui")
	local canvasPrimaryFrame = canvasGui:WaitForChild("PrimaryFrame")
	local artPlaceholder = canvasPrimaryFrame:WaitForChild("ArtPlaceholder")

	artPlaceholder.Image = "rbxassetid://" .. imageID

	local availabilityStatus = selectedFrame:WaitForChild("AvailabilityStatus")
	availabilityStatus.Color = Color3.fromRGB(255, 89, 89)
end

remoteEvent.OnServerEvent:Connect(function(player, imageID, username)
	claimFrame(player, imageID, username)
end)

initializeFrameAvailability()

Additional Information:

  • The RemoteEvent is properly set up and fired from the client side.
  • The frame updates (image, username, and availability status) work fine on the client side, but the changes aren’t visible on the server.
  • I’ve checked the server’s framesFolder to confirm that the properties are there, and I’m using :WaitForChild() for each component to ensure they’re loaded.
  • The issue seems to be that the server doesn’t recognize the changes in availability and updates (image, username) that should occur when a frame is claimed.

I’ve double-checked everything but still can’t get the server to register the updates. Any help or suggestions would be greatly appreciated!

1 Like

Are talking about replicating the gui on PlayerGui or StarterGui?

1 Like

I’m trying to replicate the updates to the SurfaceGui on the player’s frame. The updates are working fine on the client side, but the server isn’t reflecting the changes. I’m using a RemoteEvent to send the data from the client to the server, but the server doesn’t seem to update the frame’s availability or the SurfaceGui as expected.

Is there something I should be doing differently to ensure the SurfaceGui updates properly on both the client and server?

1 Like

is the availability edited on the client side or server side?

It is edited and processed on the server side.

i really am trying to figure out the problem, but to me everything looks okay. For the sake of debugging, have you tried printing what the client sends? Also, you could replace the available and unavailable values for a is IsAvailable boolvalue, true for available and false for unavailable

I haven’t printed what the client sends yet, but I’ll add some print statements to check. I’ll also try replacing Available and Unavailable with IsAvailable and IsUnavailable BoolValues and let you know how it goes. Appreciate the help!

I’m sorry but I don’t really know how to fix your script :disappointed:, I’ve replicated your system and everything worked, I assume it has to do with what the client is passing or the placement of things.

Would you like to see the LocalScript?

Thank you for your help, Pear, but I finally got it to work after months of trying.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.