Issue with Remote Events where the client script won't find the parameters From Server -> Client

You can write your topic however you want, but you need to answer these questions:

  1. **What do you want to achieve?**I want to get the client to recognize my parameter variables sent from the server

  2. **What is the issue? ** The script does not recognize my premeter variables and it shows any when typed out

  3. ** I tried to rewrite the code but the issue is still happening

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Server

local player = game.Players

-- Main Stats & values
player.PlayerAdded:Connect(function(Player)
	local Leaderstats = Instance.new("Folder")
	Leaderstats.Name = "leaderstats"
	Leaderstats.Parent = Player
	-- Cash Stats
	local Cash = Instance.new("NumberValue")
	Cash.Name = "Cash"
	Cash.Parent = Player
	Cash.Value = 0
	-- Housing Cost
	local HouseValue = Instance.new("NumberValue")
	HouseValue.Name = "Cost"
	local House = game.Workspace.HouseDoor
	local ClickDetector = House:FindFirstChild("ClickDetector")
	ClickDetector.Parent = House
	ClickDetector.MouseClick:Connect(function()
		local RemoteEvent = game.ReplicatedStorage.ShowPriceUI
		RemoteEvent:FireClient(Player,HouseValue,Cash)
		
		
	end)
end)

Client

local House_Value_UI = game.Players.LocalPlayer.PlayerGui.HousePrompt.Frame.Price
local CancelButton = game.Players.LocalPlayer.PlayerGui.HousePrompt.Frame.Cancel
local cancled = false
local Event = game.ReplicatedStorage.ShowPriceUI
local MayEnter = false
Event.OnClientEvent:Connect(function(HouseValue,Cash)
	
	House_Value_UI.Text = HouseValue.Value
	local Player = game.Players.LocalPlayer.PlayerGui
	local HousePrompt = Player.HousePrompt.Frame
	local IsPurchased = false
	local PurchaseButton = HousePrompt.Purchase
	print("The event fired")
	PurchaseButton.MouseButton1Click:Connect(function()
		end)
		print("The button has been clicked")
		if Cash.Value >= HouseValue then
			print("Purchase sucessful!")
			IsPurchased = true
		else
			if Cash.Value < HouseValue then
				print(Player.Name .. " You do not have enough money ")
				IsPurchased = false
			end
			if IsPurchased == true then
				print(Player.Name .. " Sucessfully purchased House ")
				MayEnter = true
				local HouseDoor = game.Workspace.HouseDoor
				if MayEnter then
					HouseDoor.CanCollide = false
				end
				CancelButton.MouseButton1Click:Connect(function()
					cancled = true
					end)
					if cancled then
						print(Player.Name .. " Has cancled the pruchase ")
						wait(5)
						game.Players.LocalPlayer.PlayerGui.HousePrompt.Frame.Visible = false
				end
			end
	end
end)
	

Hello, I got a issue with remote events where i sent the parameters of my variables I want to change from the server to the client and the client does not recognize them why is this happening Thanks for your help

1 Like

You need to put Player as the 1st param on the client call of the event

Because you are firing it only to one client, you need to provide that client in both client and server call.

1 Like

image
image

I put the Player parameter in both scripts and the Value is still nil showing as any when used

1 Like

Pass the HouseValue.Value instead, since it’s an instance it will not replicate unless it is parented in the workspace or replicated storage. Other limitations are listed in Remote Functions and Events Doc but I would plainly recommend avoiding instances where possible.

2 Likes