Im trying to make a handcuff script but the RemoteEvent isnt sending the data that I (probably wrongfully) expect it to.
in the local script I have function to get the players name then in the event script it anchors the HumanoidRootPart, for now Ive just got it printing out the sent data ust to test it
Local script in handcuffs
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local detainedEvent = game.ReplicatedStorage.RemoteEvents:WaitForChild("DetainedEvent")
script.Parent.Equipped:connect(function(mouse)
mouse.Button1Down:connect(function()
if mouse.Target ~= nil then
print("clicked on "..mouse.Target:GetFullName())
local plr = nil
_, plr = pcall(function()
return game.Players[mouse.Target.Parent.Name]
end)
print(plr)
if plr ~= nil then
detainedEvent:FireServer(plr )
print("Fired")
else
print('no player')
end
end
end)
end)
and the event script that is stored in ServerScriptStoeage
-- Player Captured script
local detainedEvent = game.ReplicatedStorage.RemoteEvents:WaitForChild("DetainedEvent")
local CapturedPlr = game.ReplicatedStorage.Captured
local function onDetainedFired(player)
print("server "..player.Character.Name.." Name")
--player.Character.HumanoidRootPart.Anchored = true
end
detainedEvent.OnServerEvent:Connect(onDetainedFired)
when tested if im player-1 when I read the console it shows Ive clicked on Player-2 but the server says player-1 name was sent over
