Hi! I want to make a flashlight you can pick up when you hold “E” that disappears only for you when picked up.
if script.Parent.Parent == workspace then
local proxprompt = script.Parent.ProximityPrompt
proxprompt.Triggered:Connect(function(Plr)
print("Triggered")
game.ReplicatedStorage.pickUpFlashlight:FireClient(game.Players:GetPlayerFromCharacter(Plr))
print("sent out signal")
end)
end
It isn’t even registering the pick up, let alone sending out the signal. I only need it to send the signal as I have a flashlight script that gets enabled whenever that signal is sent.
I have tried to find someone with a similar issue on the Developer hub but I haven’t found anyone.
1 Like
perhaps its because you use getPlayerFromCharacter() on Plr when Plr is already the player that triggered the prompt. Also, if the flashlight is a tool, you could just clone the tool into the backpack from the server.
1 Like
“Plr” is already a player, so no need to use getplayerfromcharacter.
perhaps, just use:
game.ReplicatedStorage.pickUpFlashlight:FireClient(Plr)
1 Like
This did work! But I’m still stumped on how to hide the flashlight after the event is fired. How can I get a server script to trigger a local script?
game.ReplicatedStorage.pickUpFlashlight.OnClientEvent:Connect(function()
--locate the flashlight in workspace then make the transparency 1 and disable the prompt
end)
I’m looking for the transparency to locally be changed rather than globally, I want every player to be able to pick it up.
it is local as it is an onclientevent and will only show for the player that triggered the prompt