This code isnt working:
- Keeps saying it has an error with the end statements
- Team "deep orange isnt receiving the tool after triggering the proximity prompt
- Proximity prompt is not being equipped to the torso of Deep Blue team
local ServerStorage = game:GetService("ServerStorage")
local poolTool = ServerStorage.Stick
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
if plr.TeamColor.Name == "Dark blue" then
local proximityPrompt = Instance.new("ProximityPrompt")
proximityPrompt.HoldDuration = 5
proximityPrompt.ObjectText = plr.Name
proximityPrompt.ActionText = "Hold E to Pickpocket"
proximityPrompt.RequiresLineOfSight = true
proximityPrompt.MaxActivationDistance = 4
local proximityHolder = Instance.new("Part")
proximityHolder.Name = "PickpocketPart"
proximityHolder.Size = Vector3.new(1, 1, 1)
proximityHolder.Transparency = 1
proximityHolder.CanCollide = false
proximityHolder.Anchored = false
proximityHolder.CFrame = char.HumanoidRootPart.CFrame - (char.HumanoidRootPart.CFrame.LookVector * 2)
local proximityWeld = Instance.new("WeldConstraint")
proximityWeld.Part0 = char.HumanoidRootPart
proximityWeld.Part1 = proximityHolder
proximityWeld.Parent = char.HumanoidRootPart
proximityPrompt.Parent = proximityHolder
proximityHolder.Parent = char.HumanoidRootPart
game.ReplicatedStorage.PickpocketRE:FireClient(plr)
proximityPrompt.Triggered:Connect(function(plr)
if plr.TeamColor.Name == "Deep orange" then
local poolCopy = poolTool:Clone()
poolCopy.Parent = plr.Backpack
end
end
end
end
end
end)