So I made this script that makes you delete your tools with Q, but later i realised that it would make all players delete their tools so i tried to fix it by sending a value with the player's name and if it matched the current player it would delete the tool, but whenever the event fires the returned value is nil, help?

local actionService = game:GetService("ContextActionService")
local dropEvent = game.ReplicatedStorage.DropEvent

local function DropTool(actionName, inputState, inputObject)
    if actionName == "Drop" and inputState == Enum.UserInputState.Begin then
		       local player = script.Parent.Parent.Name
		pn = player
		dropEvent:FireServer(pn)
		print("Event fired successfully. "..pn)
    end
end

actionService:BindAction("Drop", DropTool, false, Enum.KeyCode.Q)

Thank you!

5 comments

0

what script removes the tools?

0

I posted only the LocalScript since the Script has no errors receiving the value, and i also dont like sharing my scripts.

0

i wanted to say when you fire server the client automatically sends the player as first variable

0

How do I address it in the Server sided script, is there a name i can reference?

0

Also it sends the player as object