Hey, pri again,
I have a error with my script where it isnt erroring, but it only works correctly on the first go
Its supposed to charge the size when activated = true but after the first time it just does it without the key being held down or even being pressed at all.
local UIS = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Character = Player.Character
local Humanoid = Character.Humanoid
local Damage = 0
local Stat = Character:WaitForChild("Damage")
local Active = false
local Paper = game.ReplicatedStorage.Events.Paper
local Activated = false
UIS.InputBegan:Connect(function(Input, GPE)
if Input.KeyCode == Enum.KeyCode.X and not GPE then
Paper:FireServer(Mouse.Hit.p, Active)
Activated = true
spawn(function()
while Activated do
Damage = Damage + 1
print(Damage)
wait(1)
end
end)
end
end)
UIS.InputEnded:Connect(function(Input, GPE)
if Input.KeyCode == Enum.KeyCode.X and not GPE and Active == false then
Active = true
Activated = false
Paper:FireServer(Mouse.Hit.p, Active, Damage)
Damage = 0
end
end)
-- this is the local script
ocal Paper = game.ReplicatedStorage.Events.Paper
local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")
local function CreatePart()
local Part = Instance.new("Part")
Part.Material = "Neon"
Part.Transparency = 0.445
Part.Color = Color3.fromRGB(213, 115, 61)
Part.Shape = Enum.PartType.Ball
return Part
end
local function Weld(P0, P1)
local Weld = Instance.new("WeldConstraint")
Weld.Part0 = P0
Weld.Part1 = P1
Weld.Parent = P0
end
Paper.OnServerEvent:Connect(function(Player, MP, Active, Damage)
if Active == false then
Character = Player.Character
RightHand = Character:WaitForChild("RightHand")
Sphere = CreatePart()
Sphere2 = CreatePart()
Sphere.Size = Vector3.new(1.64, 1.64, 1.64)
Sphere.Transparency = .75
Sphere.Name = "Sphere1"
Sphere.CFrame = RightHand.CFrame * CFrame.new(0, -.5, 0)
Sphere.Anchored = false
Weld(RightHand, Sphere)
Sphere2.Color= Color3.fromRGB(248, 233, 22)
Sphere2.Size = Vector3.new(1.468, 1.468, 1.468)
Sphere2.CFrame = Sphere.CFrame
Sphere2.Anchored = false
Weld(Sphere, Sphere2)
Sphere.Parent = RightHand
Sphere2.Parent = Sphere
elseif Active == true then
Pepe = CreatePart()
Pepe2 = CreatePart()
local Character = Player.Character
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
Pepe.Size = Vector3.new(Damage * 2, Damage * 2, Damage * 2)
Pepe.Transparency = 0.445
Pepe.Anchored = false
Pepe.CFrame = HumanoidRootPart.CFrame * CFrame.new(0, 0, -5)
Pepe.Parent = workspace
Pepe2.Size = Vector3.new(Pepe.Size/ Pepe.Size, Pepe.Size)
Pepe2.Anchored = false
Pepe2.Transparency = 0.45
Pepe2.CFrame = Pepe.CFrame
Pepe2.Parent = Pepe
Weld(Pepe, Pepe2)
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
BodyVelocity.Velocity = (MP - HumanoidRootPart.Position).Unit * 250
BodyVelocity.Parent = Pepe
end
end)
-- this is the script in serverscriptservice
After one touch of the key after the second attempt, this continues to print
Ive tried asking for help on offsite places but nobody seems to be able to help me
Id appreciate any tips or help of any kind!
Thanks again,
pri