This Gun is custom made by me and is provided as a toy at the Final part of the game. Its a reward for finishing. While testing the game I had no idea that once the Gun is picked up by a player, it is not available for any other player. I want it to be available for everyone. My script is written as below. I don’t know what to do so that the gun stays available for each player who finishes.
I’ve included two videos below showing player1 and player2 that I used while testing. I show player2 with both the gun and the windchime suncatcher at the end of the game. I also show player1 who does not have either because player2 already got them. This is no good to me. I need all players to be able to get those 2 items.
.
Script
…
script.Parent.Shoot.OnServerEvent:Connect(function(player,LookAt)
local Gun = player.Backpack:FindFirstChild("Gun")or player.Character:FindFirstChild("Gun")
local cframe = Gun.Barrel.CFrame
local bullet = game.ReplicatedStorage.Bullet:Clone()
bullet.Parent = script.Parent
bullet.CFrame = cframe
bullet.Velocity = LookAt*100
local fly = Instance.new("BodyForce", bullet)
fly.Force = Vector3.new(0,bullet:GetMass()*196.2,0)
game.Debris:AddItem(bullet,10)
wait()
bullet.Touched:Connect(function()
wait(0.25)
bullet:remove()
end)
end)
…
Local Script
…
script.Parent.Activated:Connect(function()
local pos = script.Parent.Parent.Humanoid.TargetPoint
local LookAt = (pos - script.Parent.Parent.Head.Position).Unit
script.Parent.Shoot:FireServer(LookAt)
end)
…
Bullet Script
…
local debounce = true
local timebetdamage = 1
script.Parent.Touched:Connect(function(hit)
if debounce == true then
debounce = false
hit.Parent.Humanoid:TakeDamage(20)
debounce = true
end
end)
…



robloxapp-20210116-0932537.wmv (3.4 MB)
robloxapp-20210116-0933478.wmv (1.8 MB)