Struggling to get Power to go up in SB fan game?
I'm making an SB fan game and I need help with my IntValue going up Im making a killstreak glove so basically I want it to Gain 1 power every kill. There are multiple scripts that have aspects of this so it might take a while to find the issue, If you are actually taking time out of your day to help me out you deserve so the best life ever. I don't expect it to be anythng complicated probably just a typo. Thanks for your help:
Script one: Located in PlayerHit (IntValue) which is located in ServerStorage
02 | local pir = script.Parent.Parent |
03 | local humanoid = pir:FindFirstChild( "Humanoid" ) |
04 | local ePIr = script.Parent.Value |
06 | TimeToDeath = TimeToDeath - 0.1 |
08 | if TimeToDeath > 0 then |
09 | humanoid.Died:Connect( function ) |
10 | for i,v in pairs (game. Workspace:GetChildren()) do |
11 | if v:lsA( "Model" ) then |
12 | if v and v.Name = = ePIr then |
13 | if game.Players:GetPlayerFromCharacter(v).Backpack:FindFirstChild( "Killstreak" ) then |
14 | game.Players:GetPlayerFromCharacter(v).Backpack.Killstreak.Handle.HitHandler.Power.Value+ = 1 |
15 | script.Parent:Destroy() |
23 | script.Parent:Destroy() |
Script 2 located in the Handle of the killstreak Tool, has a child which is called Power and it is an IntValue
01 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
02 | local eChar = hit.Parent |
03 | local plrChar = Tool.Parent |
05 | local eHumanRootPart = eChar:FindFirstChild( "HumanoidRootPart" ) |
06 | local plrHumanRootPart = plrChar:FindFirstChild( "HumanoidRootPart" ) |
08 | if plrHumanRootPart and eHumanRootPart then |
09 | script.Disabled = true |
10 | eChar.Humanoid.Sit = true |
12 | local force = Instance.new( "BodyVelocity" , eHumanRootPart) |
13 | force.MaxForce = Vector 3. new( 2 , 2 , 2 ) * math.huge |
14 | local direction = (eHumanRootPart.CFrame.Position - plrHumanRootPart.CFrame.Position).Unit |
15 | force.Velocity = (direction + Vector 3. new( 0 , 1 , 0 )).Unit * Power.Value |
17 | local rotation = Instance.new( "BodyAngularVelocity" , eHumanRootPart) |
18 | rotation.AngularVelocity = Vector 3. new( 1 , 1 , 1 ) * math.pi * math.random( 1 , 5 ) |
19 | rotation.MaxTorque = Vector 3. new( 2 , 2 , 2 ) * math.huge |
23 | local playerHit = game.ServerStorage:FindFirstChild( "PlayerHit" ) |
25 | if eChar:FindFirstChild( "PlayerHit" ) then |
27 | local clonedPlrHit = playerHit:Clone() |
28 | clonedPlrHit.Value = plrChar.Name |
29 | clonedPlrHit.Parent = eChar |
36 | eChar.Humanoid.Sit = false |
38 | local player = game.Players:GetPlayerFromCharacter(Tool.Parent) |
39 | player.leaderstats.Slaps.Value = player.leaderstats.Slaps.Value + 1 |
41 | hitChars [ hit.Parent ] = true |
43 | script.Disabled = false |
44 | hitChars [ hit.Parent ] = nil |
48 | script.Power.Changed:Connect( function () |
49 | Power.Value = Power.Value |