Hi, So I'm asking two questions in one, so when answering it'd be awesome if you could address what question you are answering, I'll label them below.
1.) So the issue with the SCRIPT DUPLICATION GLITCH. There is a plate that when a player steps on it, it clones an item called 'Vampire' into their inventory. In vampire, there are scripts for the attacks and such, but when there are 2 players on the server the person who touches the part gets TWO vampires, this scales with the number of players on the server. How can I fix this? Heres the script that gives the vampire:
local sgiver = game.Workspace.GiveVampire
local plr = game.Players.LocalPlayer
print("Running Giver")
local VampGiver = game.ReplicatedStorage:WaitForChild("PadTouched")
local CD = false
local nvamp = 0
sgiver.Touched:Connect(function(hit)
if hit.Parent:WaitForChild("Humanoid") ~= nil and CD == false then
CD = true
print("Touched")
VampGiver:FireServer(hit)
print("Fired")
local HasStand = true
nvamp = 1
wait(10)
CD = false
end
end)
2.) So the issue with the DAMAGE DOUBLING is that when there is one player in the game, it works fine. It deals with the proper amount of damage that is mean to be done. The issue here is when there is more than one player in the server with the 'Vampire' in their inventory it just basically doubles the damage. what can I do to fix this glitch? Here is ONE of the damage scripts (this is a local script)
local player = game.Players.LocalPlayer
local db = true
local damaged = false
local Chat = false
local animR = Instance.new("Animation")
animR.AnimationId = "http://www.roblox.com/asset/?id=6029415393"
wait()
local userInputService = game:GetService("UserInputService")
userInputService.InputBegan:Connect(function(input,gameProcessedEvent)
if gameProcessedEvent then
Chat = true
else
Chat = false
end
end)
script.Parent.Parent:WaitForChild("Left Leg").Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and not db and not damaged and hit.Parent.Humanoid ~= game.Players.LocalPlayer.Character.Humanoid then
if game.Players.LocalPlayer.Character.Humanoid.Health > 0 then
damaged = true
game.ReplicatedStorage.VampKick:FireServer(hit.Parent.Humanoid)
end
end
end)
game:GetService("UserInputService").InputBegan:Connect(function(input, event, GameStuff)
if GameStuff then return end
if input.KeyCode == Enum.KeyCode.R and db and Chat == false then
print("Kick Left Nub")
db = false
game.ReplicatedStorage.ACD:FireServer()
local playAnim = script.Parent.Parent:WaitForChild("Humanoid"):LoadAnimation(animR)
playAnim:Play()
wait(2)
damaged = false
db = true
end
end)
