Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How come my weapons are broken? [SOLVED]]

Asked by
Yeevivor4 155
8 years ago

Well, the problem is that everytime I start up a Roblox Studio Server, and I use my weapons, such as a LinkedSword, the weapons does damage to the player, but it doesn't kill him. What I mean is that after doing damage, for example, Player 2 attacks Player1 and does 10 damage, the Player1's health is instantly regenerated, causing Player1 to not die. If anyone can give me help, I would appreciate it.

The problem was me adding some Values in it. After I removed it from the server the weapons magically worked again. Thanks to 1waffle1 and RandomGuyTho for helping me and giving me suggestions.

0
Maybe it's a script. Try posting a script. 1waffle1 2908 — 8y
0
The sword is not doing that. Try again. 1waffle1 2908 — 8y
0
The most likely cause of what is happening is that something is explicitly causing exactly that to happen. There could be some script running that is preventing death. I could write one. 1waffle1 2908 — 8y
0
Well, if you can do this, I would be really happy to see it and learn from it. Yeevivor4 155 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

From the looks of what I have read, it has become clear to me that you are saying that your sword works but the health regenerates after a player takes damage. If I am correct then here is the reason and how to fix it including an example.

The reason of health regeneration is that when a Character loads, a "Health" script used to regenerate a Humanoid's Heath comes within it.

In order to change this, you would have to get to a player's character and remove the "Health" script. This can be done in various ways but below is a script that assures that when a player is added, the health script inside their character is removed so that they cannot regenerate health after taking damage.

Example Code: (This should be in a LocalScript placed in the Starter Pack.)

local player = script.Parent.Parent

player.Character.ChildAdded:connect(function(child)
    repeat wait() until player.Character
    if child.Name == "Health" and child:IsA("Script") then
        child:remove()
    end
end)
Ad

Answer this question