Im trying to make a script where when a player is with a tool and when he stars an input a particle emitter connected to a part will attach to his arm, but when the input starts the character disappear, he just get deleted from the workspace
local player = game.Players.LocalPlayer
local character = player.Character
local tool = script.Parent
local skills = game.ReplicatedStorage.Skills.Wind
local uis = game:GetService("UserInputService")
local equip = false
tool.Equipped:Connect(function()
equip = true
end)
tool.Unequipped:Connect(function()
equip = false
local arm = character:FindFirstChild("RightArm")
local charge = arm:FindFirstChild("Charge")
if charge then
charge:Destroy()
end
end)
uis.InputBegan:Connect(function(input, GPE)
if input.KeyCode == Enum.KeyCode.E then
if equip == true then
print("yeah")
local arm = character:FindFirstChild("RightArm")
local charge = skills.Charge:Clone()
character.Parent = arm
local weld = Instance.new("WeldConstraint")
weld.Part0 = arm
weld.Part1 = charge
weld.Parent = charge
charge.Parent = game.Workspace.Ignore
else
return
end
end
end)
uis.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
local arm = character:FindFirstChild("RightArm")
local charge = arm:FindFirstChild("Charge")
charge:Destroy()
end
end)
local player = game.Players.LocalPlayer
local character = player.Character
local tool = script.Parent
local skills = game.ReplicatedStorage.Skills.Wind
local uis = game:GetService("UserInputService")
local equip = false
tool.Equipped:Connect(function()
equip = true
end)
tool.Unequipped:Connect(function()
equip = false
local arm = character:FindFirstChild("RightArm")
local charge = arm:FindFirstChild("Charge")
if charge then
charge:Destroy()
end
end)
uis.InputBegan:Connect(function(input, GPE)
if input.KeyCode == Enum.KeyCode.E then
if equip == true then
print("yeah")
local arm = character:FindFirstChild("RightArm")
local charge = skills.Charge:Clone()
charge.Parent = arm
local weld = Instance.new("WeldConstraint")
weld.Part0 = arm
weld.Part1 = charge
weld.Parent = charge
charge.Parent = game.Workspace.Ignore
else
return
end
end
end)
uis.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
local arm = character:FindFirstChild("RightArm")
local charge = arm:FindFirstChild("Charge")
charge:Destroy()
end
end)
Wait the entire game is crashing? Tell ne if that happens after this adjustment
local player = game.Players.LocalPlayer
local character = player.Character
local tool = script.Parent
local skills = game.ReplicatedStorage.Skills.Wind
local uis = game:GetService("UserInputService")
local equip = false
tool.Equipped:Connect(function()
equip = true
end)
tool.Unequipped:Connect(function()
equip = false
local arm = character:FindFirstChild("RightArm")
local charge = arm:FindFirstChild("Charge")
if charge then
charge:Destroy()
end
end)
uis.InputBegan:Connect(function(input, GPE)
if input.KeyCode == Enum.KeyCode.E then
if equip == true then
print("yeah")
local arm = character:FindFirstChild("RightArm")
local charge = skills.Charge:Clone()
charge.Parent = arm
charge:PivotTo(arm:GetPivot())
local weld = Instance.new("WeldConstraint")
weld.Part0 = arm
weld.Part1 = charge
weld.Parent = charge
--charge.Parent = game.Workspace.Ignore -- why are you moving it here?
else
return
end
end
end)
uis.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
local arm = character:FindFirstChild("RightArm")
if not arm then return end
local charge = arm:FindFirstChild("Charge")
charge:Destroy()
end
end)
Okay, you’ve marked your own post which is unrelated to the original problem as the solution but keep in mind your problem was “Input is making my character turn invisible,” which I solved with this line:
replacing your former line
This is the real solution to your topic.
Also this code that I added makes the charge be positioned correctly:
truly sorry, i marked and unmarked later, there wer no issue at the code, i just typed the wrong name
now i marked your answer as the solution, sorry for wasting your time