Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help please how do you make it turn green when sword is in opponents hand?

This script, will only make a sword turn green when the player stabs the opponent and the opponent is not holding the sword and having it equipped. Could someone fix this error?

handle = script.Parent.Handle

handle.Touched:connect(function(part)

if part.Parent:FindFirstChild("Humanoid") and not part.Parent:FindFirstChild("LinkedSword")then

handle.Mesh.VertexColor = Vector3.new(0, 1, 0)

else

handle.Mesh.VertexColor = Vector3.new(1, 1, 1)

end

end)

2 answers

If LinkedSword is the sword, it would be found in the same place as the Humanoid if it were selected. The only obvious problem would be if it isn't actually named "LinkedSword"

insert a script inside handle:

function HybricScripts(part)
local h = part.Parent:findFirstChild("Humanoid")
if (h ~= nil) then
script.Parent.Mesh.VertexColor = Vector3.new(0,1,0)
wait(1)
script.Parent.Mesh.VertexColor = Vector3.new(1,1,1)
end
end

script.Parent.Touched:connect(HybricScripts)

1 comment

0

Didn't work.

This discussion is preserved as it was. New answers, comments, and votes are closed.