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

Resetting and Blue Team Is Not Working, Why?

Asked by 8 years ago

Hello, I have made the following script to give the player a tool based on their team color. Can you help me with why it isn't working for blue and red get the blue weapon? Here is the script:

function giveWeapon(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local alreadyHaveValue = hit.Parent:FindFirstChild("MyBool")
print(alreadyHaveValue)         
    if alreadyHaveValue == nil then
        print(hit)
        print(hit.Parent)               
        myValue = Instance.new("BoolValue")
        myValue.Name = "MyBool"
        myValue.Parent = hit.Parent
        myValue.Value = false
    elseif myValue == true then
        myValue:Delete()
    end
    if player ~= nil and myValue.Value == false then
        myValue.Value = true            
        if player.TeamColor == BrickColor.new("Really blue") then
            print("I'm on team blue")                   
            local BlueLaserGun = game.Workspace.BlueLaserGun:Clone()
            BlueLaserGun.Parent = game.StarterPack
            elseif player.TeamColor == BrickColor.new("Really red") then
            print("I'm on team red")                        
            local RedLaserGun = game.Workspace.RedLaserGun:Clone()
            RedLaserGun.Parent = player.Backpack
        end

Thanks! Have a great day!

0
Can you include the whole script? BlueTaslem 18071 — 8y

Answer this question