Ad
Log in to vote
0

why does it say nil but doesnt take me to the problem when i click on it?

Asked by 4 days ago

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function() local function teamFromColor(color) for _,t in pairs(game:GetService("Teams"):GetChildren()) do if t.TeamColor==color then return t end end return nil end

local function onSpawned(plr) local tools = teamFromColor(plr.TeamColor):GetChildren() for _,c in pairs(tools) do c:Clone().Parent = plr.Backpack end end

local function onChanged(prop,plr) if prop=="Character" then onSpawned(plr) end end

local function onAdded(plr) plr.Changed:connect(function(prop) onChanged(prop,plr) end) end

game.Players.PlayerAdded:connect(onAdded) game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function() wait(1) local pnts = script.Pants local shirt = script.Shirt

local function GiveClothes(character) if not character:findFirstChild("Shirt") then shirt:Clone().Parent = character else character:findFirstChild("Shirt"):Destroy() shirt:Clone().Parent = character end

if not character:findFirstChild("Pants") then pnts:Clone().Parent = character else character:findFirstChild("Pants"):Destroy() pnts:Clone().Parent = character end end

game.Players.PlayerAdded:connect(function(p) p.CharacterAdded:connect(function(char) wait(1.12) local plr = game.Players:findFirstChild(char.Name) print(char.Name)

if plr.TeamColor ~= BrickColor.new("New Yeller") then return else GiveClothes(char) end end) end) end

local Sound1 = script.Sound1 local Sound2 = script.Sound2 local Sound3 = script.Sound3 local Sound4 = script.Sound4 local Sound5 = script.Sound5 local Sound6 = script.Sound6 local Sound7 = script.Sound7 local Sound8 = script.Sound8 local Sound9 = script.Sound9 local Sound10 = script.Sound10 local Sound11 = script.Sound11 local Sound12 = script.Sound12 local Sound13 = script.Sound13

local S = 0 game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function() repeat wait(math.random(5,10)) S = math.random(1,13) if S == 1 then Sound1:Play() end i wait(5) script.Parent.Text = "Loading Complete!"

repeat wait(0.01) script.Parent.TextTransparency = script.Parent.TextTransparency + 0.01 game.Workspace.e:Play() game.Workspace.e.Volume = game.Workspace.e.Volume + 0.04 until script.Parent.TextTransparency >= 1

repeat wait(0.001) script.Parent.Parent.Creator.TextTransparency = script.Parent.Parent.Creator.TextTransparency - 0.01 until script.Parent.Parent.Creator.TextTransparency <= 0

repeat wait(0.001) script.Parent.Parent.Creator.TextTransparency = script.Parent.Parent.Creator.TextTransparency + 0.01 until script.Parent.Parent.Creator.TextTransparency >= 1

repeat wait(0.001) script.Parent.Parent.Title.TextTransparency = script.Parent.Parent.Title.TextTransparency - 0.01 script.Parent.Parent.Play.TextTransparency = script.Parent.Parent.Play.TextTransparency - 0.01 until script.Parent.Parent.Title.TextTransparency <= 0 and script.Parent.Parent.Play.TextTransparency <= 0 r = game:service("RunService")

local damage = 100

sword = script.Parent.Handle Tool = script.Parent

local damages,values,sounds = {100,100,100},{Tool.PlaySlash,Tool.PlayThrust,Tool.PlayOverhead},{Tool.Handle.SlashSound,Tool.Handle.OverheadSound,Tool.Handle.LungeSound} local enabledToDamage = true

function blow(hit) if enabledToDamage == false then return end enabledToDamage = false if (hit.Parent == nil) then enabledToDamage = true return end -- happens when bullet hits sword local humanoid = hit.Parent:findFirstChild("Humanoid") local vCharacter = Tool.Parent local vPlayer = game.Players:playerFromCharacter(vCharacter) local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character if humanoid~=nil and humanoid ~= hum and hum ~= nil then -- final check, make sure sword is in-hand local right_arm = vCharacter:FindFirstChild("Right Arm") if (right_arm ~= nil) then local joint = right_arm:FindFirstChild("RightGrip") if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then tagHumanoid(humanoid, vPlayer) humanoid:TakeDamage(damage) wait(30) untagHumanoid(humanoid) else enabledToDamage = true end else enabledToDamage = true end else enabledToDamage = true end end

function tagHumanoid(humanoid, player) local creator_tag = Instance.new("ObjectValue") creator_tag.Value = player creator_tag.Name = "creator" creator_tag.Parent = humanoid end

function untagHumanoid(humanoid) if humanoid ~= nil then local tag = humanoid:findFirstChild("creator") if tag ~= nil then tag.Parent = nil end end end

function attack() damage = slash_damage script.Parent.Handle.SlashSound:Play() script.Parent.PlaySlash.Value = not script.Parent.PlaySlash.Value end

function lunge() damage = lunge_damage script.Parent.Handle.LungeSound:Play() script.Parent.PlayOverhead.Value = not script.Parent.PlayOverhead.Value force = Instance.new("BodyVelocity") force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80 force.Parent = Tool.Parent.Torso wait(.5) force.Parent = nil wait(.5) damage = slash_damage end

Tool.Enabled = true local last_attack = 0 local status = 0

function onActivated() if not Tool.Enabled then return end Tool.Enabled = false local character = Tool.Parent; local humanoid = character.Humanoid if humanoid == nil then print("Humanoid not found") return end t = r.Stepped:wait() if (t - last_attack < 1.5) then if status == 3 then status = 0 damage = 0 else status = status + 1 values[status].Value = not values[status].Value damage = damages[status] sounds[status]:Play() enabledToDamage = true wait(0.5) enabledToDamage = false end else status = 0 damage = 0 end last_attack = t Tool.Enabled = true end

function onEquipped() wait(1/3) Tool.Handle.UnsheathSound:Play() end

Tool.Equipped:connect(onEquipped) script.Parent.Activated:connect(onActivated) connection = sword.Touched:connect(blow)

Answer this question