Remote Event is not transferring Data properly

Hello Developers,
Im currently making a Halo Shop for my Game and I have a little problem:
I have different Buttons where you can buy different Halos and I have a Buy Button with an IntValue.
(the Buy3 is the BuyButton)
The IntValue gets changed to the Name of the selected Halo if one of these HaloButtons is clicked.
My Problem is that the IntValue which gets changed to the Halo name gets registered as 0, even if it got changed…
This is the Remote Handler which fires the Remote Events. The HaloName is the changed Value.
Local Script:

local HaloName = script.Parent.Halo.Value
local Price = script.Parent.Price.Value

script.Parent.MouseButton1Click:Connect(function()
	if script.Parent.Text == "BUY" then
		if game.Players.LocalPlayer.leaderstats.Points.Value >= Price then
			script.Parent.Text = "EQUIP"
			script.Parent.BackgroundColor3 = Color3.fromRGB(128, 212, 116)
			game.ReplicatedStorage.HaloEvents.BuyHalo:FireServer(HaloName, Price)
		else
			script.Parent.Text = "Not enough Points"
			script.Parent.BackgroundColor3 = Color3.fromRGB(253, 90, 86)
			wait(1)
			script.Parent.Text = "BUY"
			script.Parent.BackgroundColor3 = Color3.fromRGB(47, 160, 255)
		end
	elseif script.Parent.Text == "EQUIP" then
		script.Parent.Text = "UNEQUIP"
		script.Parent.BackgroundColor3 = Color3.fromRGB(253, 90, 86)
		game.ReplicatedStorage.HaloEvents.DestroyHalos:FireServer()
		wait(0.5)
		game.ReplicatedStorage.HaloEvents.EquipHalo:FireServer(HaloName)
	elseif script.Parent.Text == "UNEQUIP" then
		script.Parent.Text = "EQUIP"
		script.Parent.BackgroundColor3 = Color3.fromRGB(128, 212, 116)
		game.ReplicatedStorage.HaloEvents.UnequipHalo:FireServer(HaloName)
	end
end)

So basically the Local Script just fires different Remote Events, it also check if the Halo is owned or not. There is also a Server Script in ServerScriptService which handles the Remotes. The Equip Remote Event basically just Equips the Selected Halo Name which was transfered by the Remote Event.
Server Script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local EquipEvent = ReplicatedStorage.HaloEvents.EquipHalo
local Halo = ReplicatedStorage.HaloEvents.Halos

EquipEvent.OnServerEvent:Connect(function(player, HaloName)
	local Folder = player:WaitForChild("OwnedHalos")
	local character = player.Character
	local humanoid = character.Humanoid
	local clone = Folder[HaloName]:Clone()
	for i, v in pairs(Folder:GetChildren()) do 
		if v:IsA("Accessory") then
			if string.match(v.Name.lower, "Halo") then
				v:Destroy() 
			end
		end
	end
	wait(0.5)
	humanoid:AddAccessory(clone)
end)

The error here is that the transferred Value is still 0, even if it should be (in this case) Red Halo…
Error in Output:
0 is not a valid member of Folder “Players.0xzMq.OwnedHalos” - Server - HaloHandler:52
Thats because the “Value” which I use to transfer the Name of the Halo is an IntValue which the StarterValue 0.
So my problem is that this Script (Local Script):

local Buy = game.Players.LocalPlayer.PlayerGui.MainGuis.BuyFrame
local HaloName = Buy.Buy3.Halo

script.Parent.MouseButton1Click:Connect(function()
HaloName.Value = script.Parent.Name
end)

This is the Script which changed the IntValue to the Halo Name which should be given when clicking the Equip Button. Since this is Client Sided I think the Server just reads the Value as 0 because it got changed Client Sided. My question: Is there a way to change the Value to the Name of the Halo (so the Name of the Halo Button), that also the Server “notices” the Value change to the Halo Name?
Any help would be HIGHLY appreciated!!!

Somehow it could not upload an Image for this… It is just a Button which is called Buy3 (that’s the Button with the IntValue in it)

OK SORRY TO EVERYONE WHO Read this… I noticed that you can’t use strings in Int Values… I changed the IntValue to a StringValue, but somehow the Value doesn’t changes to the HaloButton Name too…

You are reading the value at startup, instead of setting HaloName to Halo.Value, set it to just Halo.

Then when you pass the value in the remote events, pass it HaloName.Value

1 Like