-
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.” -
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. -
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!