I have a value(WeaponName) that is passed from the client to the server through a RemoteEvent, that is stored in a table using a modulescript in the server, but this value isnt set through when testing the game normaly in the studio and no errors related to this shows, and when I start debugging the game to see whats hapenning it works
Client(LocalScript):
local CoreEvent:RemoteEvent = game.ReplicatedStorage.RemoteEvents:WaitForChild("CoreEvent")
for _, v in pairs(WeaponSelectorGUI.DropdownButton.DropdownFrame:GetChildren()) do
if v:IsA("TextButton") then
v.MouseButton1Click:Connect(function()
CoreEvent:FireServer("WeaponSelect", v.Text)
end)
end
end
Server:
- CoreScript:
local WeaponName = Arg1
plr:LoadCharacter()
char = plr.Character
for _, v in pairs(workspace:GetChildren()) do
if v:IsA("SpawnLocation") then
if v.Name == "SpawnLocation" then
char:MoveTo(v.Position)
end
end
end
for _, v in pairs(WeaponFolder:GetChildren()) do
if v.Name == WeaponName and not v:FindFirstChild("GamepassId") then
char = plr.Character
task.spawn(function()
StatusScript.setCurrentWeapon(char, WeaponName)
end)
end
if v.Name == WeaponName and v:FindFirstChild("GamepassId") and MPS:UserOwnsGamePassAsync(plr.UserId, v.GamePassId.Value) then
char = plr.Character
task.spawn(function()
StatusScript.setCurrentWeapon(char, WeaponName)
end)
end
end
StatusScript:
function module.setCurrentWeapon(character, value)
local data = StatusData.CharacterData[character]
if data then
data.CurrentWeapon = value
local player = Players:GetPlayerFromCharacter(character)
if player then
StatusData.UpdatePersistentData(player, "CurrentWeapon", value)
end
end
end
StatusData:
-- Create a table to store all character data
StatusData.CharacterData = {}
-- Create a table to store persistent player data
StatusData.PlayerData = {}
-- Function to initialize character data
function StatusData.InitializeCharacter(character)
local player = Players:GetPlayerFromCharacter(character)
if not player then return end
-- Check if theres existing player data
local playerData = StatusData.PlayerData[player.UserId]
StatusData.CharacterData[character] = {
LastAttack = 0,
CurrentWeapon = playerData and playerData.CurrentWeapon or "Fists",
CurrentClass = playerData and playerData.CurrentClass or "Adventurer",
ActualCombo = 1,
PlayerPosture = 20,
PrimaryState = "Idle",
BooleanStates = {
Stunned = false,
Rooted = false,
Parrying = false,
Parried = false,
Running = false,
Blocking = false,
Dodging = false,
HyperArmor = false,
Ragdolled = false
}
}
-- Initialize persistent player data if it doesn't exist
if not playerData then
StatusData.PlayerData[player.UserId] = {
CurrentWeapon = StatusData.CharacterData[character].CurrentWeapon,
CurrentClass = StatusData.CharacterData[character].CurrentClass
}
end
end
those are the parts that manage that value in the scripts.
this is video proof of this happening
Im really lost, because other values set through the same script (StatusScript) are actually updated on the table.