Museum Type Robbery malfunction

Hey there!

Recently I’ve been trying to make a Museum Robbery like Jailbreak.

In the Jailbreak museum robbery, once you hold e you get a bag on your back along with a money displayer.

The issue is that once I fire my proximity prompt, the server adds it for everyone and I do not want this. It has to add the bag to the player that fires it, not everyone

Scripts:

--proximityprompt
script.Parent.ProximityPrompt.Triggered:Connect(function(pModel)
	script.Parent.bagEvent:Fire(pModel)
end)
--baggiver in staterchracterscripts
game.Workspace.MuseumRobbery.BagGiver.bagEvent.Event:Connect(function()
	local pModel = script.Parent
	local hum = pModel:WaitForChild("Humanoid")
	local ss = game:GetService("ServerStorage")
	local bag = ss:WaitForChild("Bag"):Clone()
	hum:AddAccessory(bag)
end)

image

Video with error:
2021-05-05 18-37-29|video
(my apoligies if you have to download it.)

Any help is appreciated <3

Likely because the Event connection is made for every character because it’s in StarterCharacterScripts. I’d recommend just putting the script somewhere with it is made once, such as ServerScriptService, and changing your code around that

So the event script would be

workspace.MuseumRobbery.BagGiver.bagEvent.Event:Connect(function(player)
	local pModel = player.Character
	if not pModel then
		return
	end
	local hum = pModel:WaitForChild("Humanoid")
	local ss = game:GetService("ServerStorage")
	local bag = ss:WaitForChild("Bag"):Clone()
	hum:AddAccessory(bag)
end)

Triggered returns the player instance of who triggered the prompt, so you need to get the character from it

1 Like

Thank you so much for helping me out! Can’t believe I’m this stupid that I did script.Parent and not player.Character :joy:

Thank you so much <3

1 Like