Creating stats an Energy Punch Help Me

I want to create a script when a player pumps a certain amount of power and after that he gets different energy punch

 if power == "energy punch" then
	if not game.Workspace:FindFirstChild(player.Name.."'s Energy Blast") then
		local punch = game.ServerStorage.Powers.EnergyPunch:Clone()
		punch.CFrame = character.HumanoidRootPart.CFrame
		punch.Name = player.Name.."'s Energy Blast"

		punch.Parent = game.Workspace
		
		local antiGrav  = Instance.new("BodyForce")
		antiGrav.Force = Vector3.new(0, workspace.Gravity * punch:GetMass(), 0)
		antiGrav.Parent = punch
		
		punch.Velocity = CFrame.new(player.Character.HumanoidRootPart.Position, mouse).lookVector * 450
		
			if not player.Safe.Value then
				punch.Touched:Connect(function(hit)
				local DMG = player.Strength.Value + 1
				if hit.Parent ~= character and game.Players:GetPlayerFromCharacter(hit.Parent) then
					TakeDamage:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent), player)
					local tag = Instance.new("ObjectValue")
					tag.Value = player
					tag.Name = "creator"
					tag.Parent = hit.Parent.Humanoid
					
					
					game:GetService("Debris"):AddItem(tag, 0.5)
						script.Disabled = true
						wait(0.1)
						script.Disabled = false
					end
				end)
		end
		
		Debris:AddItem(punch, 1.3)
	end
end
2 Likes

for example, when a player made 10 of his strength, his energy strike changed, etc.

no one wrote anything

1 Like

help me please help me it is very necessary

1 Like

guys, help me do it, I can’t write it myself, can you at least give an example?

1 Like

It looks like you’re trying to create a script that allows a player to perform an “Energy Punch” action after reaching a certain power level, and then apply damage to other players upon punching them. I see that the script is mostly there, but there are some parts missing. Here’s the continuation of your script along with some explanations:

luaCopy code

local player = game.Players.LocalPlayer
local character = player.Character
local mouse = player:GetMouse()
local TakeDamage = game.ReplicatedStorage.TakeDamage -- Assuming this is a RemoteEvent for damage handling

if player.Power.Value >= 100 then -- Assuming you're checking the power level to be >= 100 for the Energy Punch
	local punch = game.ServerStorage.Powers.EnergyPunch:Clone()
	punch.CFrame = character.HumanoidRootPart.CFrame
	punch.Name = player.Name.."'s Energy Blast"
	punch.Parent = game.Workspace

	local antiGrav  = Instance.new("BodyForce")
	antiGrav.Force = Vector3.new(0, workspace.Gravity * punch:GetMass(), 0)
	antiGrav.Parent = punch
		
	punch.Velocity = CFrame.new(player.Character.HumanoidRootPart.Position, mouse.Hit.p).lookVector * 450
	
	punch.Touched:Connect(function(hit)
		local targetPlayer = game.Players:GetPlayerFromCharacter(hit.Parent)
		if targetPlayer and targetPlayer ~= player then
			local DMG = player.Strength.Value + 1
			TakeDamage:FireServer(targetPlayer, DMG, player) -- FireServer instead of FireClient

			local tag = Instance.new("ObjectValue")
			tag.Value = player
			tag.Name = "creator"
			tag.Parent = hit.Parent.Humanoid
		end
	end)
end

Please make sure you have the appropriate references set up for player.Power, player.Strength, game.ReplicatedStorage.TakeDamage, and the game.ServerStorage.Powers.EnergyPunch object in your game.

Remember to adjust the values and references to fit your game’s setup. Also, consider organizing your code into functions to improve readability and maintainability.

1 Like

I love you, of course, in this sense of the script, thank you for your help, then I’ll check but how did I make it so that when the player gained 100 strength and he had a red ball and when he made 1k of strength and his ball changed, show me how to change it

You’re welcome! I’m glad the script continuation was helpful. To change the appearance of the Energy Punch based on the player’s strength level, you can modify the script as follows:

luaCopy code

local player = game.Players.LocalPlayer
local character = player.Character
local mouse = player:GetMouse()
local TakeDamage = game.ReplicatedStorage.TakeDamage -- Assuming this is a RemoteEvent for damage handling

local strength = player.Strength.Value

local punchModelName = "EnergyPunchRed" -- Default model name

if strength >= 100 and strength < 1000 then
    punchModelName = "EnergyPunchRed" -- Update this to the appropriate asset name for the red ball
elseif strength >= 1000 then
    punchModelName = "EnergyPunchBlue" -- Update this to the appropriate asset name for the blue ball
end

local punch = game.ServerStorage.Powers[punchModelName]:Clone()
punch.CFrame = character.HumanoidRootPart.CFrame
punch.Name = player.Name.."'s Energy Blast"
punch.Parent = game.Workspace

local antiGrav  = Instance.new("BodyForce")
antiGrav.Force = Vector3.new(0, workspace.Gravity * punch:GetMass(), 0)
antiGrav.Parent = punch

punch.Velocity = CFrame.new(player.Character.HumanoidRootPart.Position, mouse.Hit.p).lookVector * 450

punch.Touched:Connect(function(hit)
    local targetPlayer = game.Players:GetPlayerFromCharacter(hit.Parent)
    if targetPlayer and targetPlayer ~= player then
        local DMG = player.Strength.Value + 1
        TakeDamage:FireServer(targetPlayer, DMG, player)

        local tag = Instance.new("ObjectValue")
        tag.Value = player
        tag.Name = "creator"
        tag.Parent = hit.Parent.Humanoid
    end
end)

Replace "EnergyPunchRed" and "EnergyPunchBlue" with the appropriate asset names for the red and blue ball models you have in your game. This modified script will change the appearance of the Energy Punch model based on the player’s strength level.

Remember to adjust the logic and model names according to your game’s setup. This will allow the player to have different Energy Punch models based on their strength level.

1 Like

look I need to change the name correctly of my model

 if strength >= 100 and strength < 1000 then
punchModelName = "EnergyPunchRed" -- 
Update this to the appropriate asset name for 
the red ball

elseif strength >= 1000 then
punchModelName = "EnergyPunchBlue" -- 
Update this to the appropriate asset name for 
 the blue ball
 end

It looks like you’re trying to change the name of a model based on the player’s strength level, and you want to set different names for different strength ranges. The code snippet you provided is mostly correct, but there seems to be an issue with the quotes around the asset names. Use straight double quotes (") instead of the curly double quotes (“ and ”). Here’s the corrected version of your code:

luaCopy code

if strength >= 100 and strength < 1000 then
    punchModelName = "EnergyPunchRed" -- Update this to the appropriate asset name for the red ball
elseif strength >= 1000 then
    punchModelName = "EnergyPunchBlue" -- Update this to the appropriate asset name for the blue ball
end

Make sure to replace "EnergyPunchRed" and "EnergyPunchBlue" with the actual asset names for the red and blue balls in your game.

With this code, punchModelName will be assigned the appropriate asset name based on the player’s strength level. You can then use punchModelName to load or create the corresponding model in your game.

1 Like

thank you for your help, I will fix it soon good luck VPM and thank you for your help again

np man i am here for you guys to help

1 Like

hello, I made your script on mine and added a balloon, but it didn’t work, can you help me, it doesn’t give errors

wait i am kinda busy rn so i can’t help rn maybe soon if i am done

Can you help, I’ve been waiting for help for a week

please help me, you kind people

please help kind people please any help will be useful help to fix this damn script already

Kick-ass a full month has passed, and still no one has helped me, of course, I just need to make statistics: when a player has 10 forces, the ball changes to red, and when he has 100 forces, then change to blue, and so on, help me do it already please help me fix this chept script please

What is the current script you have in your game?

local player = game.Players.LocalPlayer
local character = player.Character
local mouse = player:GetMouse()
local TakeDamage = game.ReplicatedStorage.TakeDamage – Assuming this is a RemoteEvent for damage handling

local strength = player.Strength.Value

local punchModelName = “EnergyPunchRed” – Default model name

if strength >= 100 and strength < 1000 < 10000 then
punchModelName = “EnergyPunchRed” – Update this to the appropriate asset name for the red ball
elseif strength >= 1000 then
elseif strength >= 10000 then
punchModelName = “EnergyPunchBlue” – Update this to the appropriate asset name for the blue ball
end
punchModelName =“EnergyPunchGreen
local punch = game.ServerStorage.Powers[punchModelName]:Clone()
punch.CFrame = character.HumanoidRootPart.CFrame
punch.Name = player.Name…”'s Energy Blast"
punch.Parent = game.Workspace

local antiGrav = Instance.new(“BodyForce”)
antiGrav.Force = Vector3.new(0, workspace.Gravity * punch:GetMass(), 0)
antiGrav.Parent = punch

punch.Velocity = CFrame.new(player.Character.HumanoidRootPart.Position, mouse.Hit.p).lookVector * 450

punch.Touched:Connect(function(hit)
local targetPlayer = game.Players:GetPlayerFromCharacter(hit.Parent)
if targetPlayer and targetPlayer ~= player then
local DMG = player.Strength.Value + 1
TakeDamage:FireServer(targetPlayer, DMG, player)

    local tag = Instance.new("ObjectValue")
    tag.Value = player
    tag.Name = "creator"
    tag.Parent = hit.Parent.Humanoid
end

end)

local antiGrav = Instance.new(“BodyForce”)
antiGrav.Force = Vector3.new(0, workspace.Gravity * punch:GetMass(), 0)
antiGrav.Parent = punch

punch.Velocity = CFrame.new(player.Character.HumanoidRootPart.Position, mouse.Hit.p).lookVector * 450

punch.Touched:Connect(function(hit)
local targetPlayer = game.Players:GetPlayerFromCharacter(hit.Parent)
if targetPlayer and targetPlayer ~= player then
local DMG = player.Strength.Value + 1
TakeDamage:FireServer(targetPlayer, DMG, player)

    local tag = Instance.new("ObjectValue")
    tag.Value = player
    tag.Name = "creator"
    tag.Parent = hit.Parent.Humanoid
end

end)

help yes, add strength or not, I just want to make such a system does, not work