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

Player A has tool Scissors and can only hurt players with tool Paper?

Asked by 4 years ago
Edited 4 years ago

--Player A has tool Scissors and can only kill players with tool Paper. --Player B has tool Rock and can only kill players with tool Scissors. --Player C has tool paper and can only kill players with tool Rock.

--This would be for player with tool scissors --script would be child of Scissors>Handle

local Handle = script.Parent

local DamageAmount = 100

local function DealDamage(part)

local orb = part.Parent:FindFirstChild("Paper")

local hum = part.Parent:FindFirstChild("Humanoid")

if hum and orb == true then

hum.Health = hum.Health - DamageAmount

end

end

Handle.Touched:Connect(DealDamage)

0
lol you might wanna edit this a bit speedyfox66 237 — 4y
0
Have you used it yet? If so, Accept answer Farsalis 369 — 4y

1 answer

Log in to vote
0
Answered by
Farsalis 369 Moderation Voter
4 years ago
Edited 4 years ago

A Bit Rushed But, Here Is The Code:

local SP = script.Parent
local plr = game.Players.LocalPlayer
local Char = plr.Character or plr.CharacterAdded:Wait()
local Humanoid = Char:WaitForChild("Humanoid", 2)
local pname = plr.Name
local value = SP.ItemValue
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://04110091372"
local Load = Humanoid:LoadAnimation(Animation)
local equipped = false
local activated = false
local unequipped = true

local pn = {
    ['S/P'] = {'Scissor', 'Paper'};
    ['P/R'] = {'Paper', 'Rock'};
    ['R/S'] = {'Rock', 'Scissor'}   
    }

function Touched(hit)
    local humanoid = hit.Parent:WaitForChild("Humanoid", 1)
        if Char.Name == pname and Humanoid and Equipped and hit.Parent.Name ~= Char.Name then
            wait(1)
            for _,v in pairs(pn) do
                print(v[1])
                if value.Value == v[1] and humanoid then
                    local strong = v[2] -- What The Player's Weapons Strong Point Is
                    for _,p in pairs(hit.Parent:GetChildren()) do -- Cycle Through Potential Enemy
                        if p.Name == strong then
                            local en = hit.Parent:WaitForChild("Humanoid", 2)
                            en.Health = en.Health - math.random(1,10)
                        else
                            assert('Cant Attack A Player With: '..p.Name..". You Have: "..value.Value)
                            end
                        end
                else
                    assert('Cant Find: '..value.Value)
                    end
                end
        else
            assert('Cant Find Correct Character Or Living Humanoid')
        end
    end

function Equipped()
    equipped = true
end

function Activated()
    Load:Play()
end

function Unequipped()
    equipped = false
end

SP.Activated:Connect(Activated)
SP.Equipped:Connect(Equipped)
SP.Handle.Touched:Connect(Touched)

Hope This Helped!

0
Thank you so much for your post! I think I was not clear that PlayerA would have a different tool than Player B. Any chance to take a look at the edited question? BricBash3r 2 — 4y
0
So, you need a script to assign different items to individual players? Farsalis 369 — 4y
0
The Local script above can be modified to inflict damage on a player, if thats whay youre asking\ Farsalis 369 — 4y
0
Not really..The players already have the items. I just need to make it so Player with scissors can only kill player with paper. And player with paper can only kill player with rock. And player with rock only kill player with scissors BricBash3r 2 — 4y
View all comments (5 more)
0
Oh, ok. Farsalis 369 — 4y
0
Will post an edited script in a sec Farsalis 369 — 4y
0
Done Farsalis 369 — 4y
0
omg thanks I will check this out as soon as possible, you are amazing for all your help;! BricBash3r 2 — 4y
0
Np, make sure, you add a stringvalue in the tool with "Scissor" , "Paper" etc.. Farsalis 369 — 4y
Ad

Answer this question