So here i go again asking i just need to know what did i do wrong, because this is the script
local tool = script.Parent local player = game.Players.player tool.Equipped:connect(function(mouse) print("Tool equipped!") tool.Activated:Connect(function() print("Mouse pressed!") local tool2 = game.Lighting.Revolver tool2:Clone().Parent = player.Backpack wait(0.5) tool:Destroy() end) end)
and after i test it out it said Backpack isn't a valid member of Player (this is not local script this is normal script) i need to know why it doesn't read player's inventory.
You need to call the player correctly,, Since this is a server script, it won't be able to detect a "Local"Player, as Sinister said earlier. You'll need to call the player some other way.
There are a few ways to do this,
game.Players.PlayerAdded:Connect(function(player)
I wouldn't doubt if you've heard of "game.Players.PlayerAdded", it's very useful for server scripts, It will run the function whenever a; player is added to the game service "Players" The argument "(player)" is the, in other words, LocalPlayer you're searching for.
Another way is through RemoteEvents, I most commonly use RemoteEvents as a way to get the local player in a server script. I recommend you doing some research on RemoteEvent's, they're extremely crucial to scripting. They can be a lil' tricky at the start to understand and grasp, but once you learn how they work, and etc. I'm sure they'll make your job wayy easier!