Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

StringValue results nil when passed through a remote event?

Asked by 4 years ago

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!

0
what script removes the tools? Leamir 3138 — 4y
0
I posted only the LocalScript since the Script has no errors receiving the value, and i also dont like sharing my scripts. TheOnlineItalian213 99 — 4y
0
i wanted to say when you fire server the client automatically sends the player as first variable tomekcz 174 — 4y
0
How do I address it in the Server sided script, is there a name i can reference? TheOnlineItalian213 99 — 4y
0
Also it sends the player as object tomekcz 174 — 4y

Answer this question