Hey, im making a script where when someone trigger a prompt he receive a tool in his inventory
i already made a script for it but it doesnt work and i dont understand why
heres the script :
local prompt = game.Workspace.FuseTOOLpart.ProximityPrompt
prompt.Triggered:Connect(function(PlayerName)
local Clone = game.ServerStorage.FuseGreen:Clone()
Clone.Parent = game.Players.PlayerName.Backpack
end)
This is the line where the issue comes from. Yes, you made PlayerName a parameter in the function, but when you use it to search in the explorer, it will quite literally look for a player with the name “PlayerName”, which it can not find.
Also, it’s a bit of a workaround. I’ve simplified the script for you. Tested it and it works. Make sure this is a ServerScript so the tool gets cloned properly.
local prompt = game.Workspace.FuseTOOLpart.ProximityPrompt
prompt.Triggered:Connect(function(player)
--[[You don't get the player's name
specifically, you get the player from PlayerService.
The player's name would be player.Name]]--
local Clone = game.ServerStorage.FuseGreen:Clone()
Clone.Parent = player.Backpack --[[No need for the explorer,
just access their backpack through the player parameter.]]--
end)