Value keeps registering as Player

I’m currently making a game and I’m trying to carry a value through a Client-Server Remote event, but every single time the output is always Player.

Client Script:

local http = game:GetService("HttpService")

script.Parent.MouseButton1Click:Connect(function()
	if game.Players.LocalPlayer.leaderstats.Coins.Value >= 20 then
		game.Players.LocalPlayer.leaderstats.Coins.Value = game.Players.LocalPlayer.leaderstats.Coins.Value - 20
		local Tablee = {

		plr = game.Players.LocalPlayer.Name,
		targetplayer = script.Parent.Parent.Parent.Target.Value,

	}

		local stringTable = http:JSONEncode(Tablee)
		local plr = game.Players.LocalPlayer
		local target = script.Parent.Parent.Parent.Target
		local targetplr = game.Players:FindFirstChild(target.Value)
	
		game.ReplicatedStorage.Remotes.Bully.Blind:FireServer(Tablee.plr, Tablee.targetplayer)
	end
end)

The values that are supposed to be carried through are “plr”, and “targetplayer”, plr works just fine, but whenever targetplayer is carried through it always outputs as plr

Server Script:

remotes.Blind.OnServerEvent:Connect(function(Player, targetplayer)
	local targetplr = game.Players:FindFirstChild(targetplayer)
	local plr = game.Players:FindFirstChild(Player)
	print(Player.Name.. " bullied ".. targetplr.Name)
	targetplr.PlayerGui.BullyOthers.Blind.Visible = true
	targetplr.PlayerGui.BullyOthers.Blind.Time.Disabled = false
	Player.leaderstats.PeopleBullied.Value = Player.leaderstats.PeopleBullied.Value + 1
	local chatTable = {

		bullyitem = "blinded",
		plr = Player.Name,
		targetplayer = targetplr.Name

	}

	local stringTable = http:JSONEncode(chatTable)

	game.ReplicatedStorage.Remotes.ChatHandler.Level1:FireAllClients(stringTable)
end)

I don’t know if there is an easy fix to this, I’m still pretty new to scripting, but I’ve never had this sort of issue pop up before, I’ve tried solutions on different posts but none of them seem to work

That is because the first var in the OnServerEvent is the player No matter if you define it or not. So

	game.ReplicatedStorage.Remotes.Bully.Blind:FireServer(Tablee.plr, Tablee.targetplayer)

should be replaced with just

	`game.ReplicatedStorage.Remotes.Bully.Blind:FireServer(Tablee.targetplayer)`

Because “Tablee.plr” Is already defined in the connected event So what your doing is basically having the same player on both variables

2 Likes

Okay I’ll try that out, thanks

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