Hi, I am making a script were if you click F then a part should appear on the player.
The script works fine when you use it, but when you move somewhere else and click F a part appears only in the place you first clicked F.
Here is my script:
local player = game.Players.LocalPlayer
local character = player.CharacterAdded:wait()
local torso = character:WaitForChild("Torso")
local playerscripts = game.Players.LocalPlayer.PlayerScripts
local humanoid = character:WaitForChild("Humanoid")
local sharinganimage = player.PlayerGui.SharinganImage
local Image1 = sharinganimage.Image1
local Jutsu1 = sharinganimage:WaitForChild("Jutsu1")
local lighting = game.Lighting
local OutdoorAmbient = lighting.OutdoorAmbient
local activate = playerscripts.SharinganV2.Activated
local ActivateSound = playerscripts.SharinganV2.Ssound
local DeactivateSound = playerscripts.SharinganV2.SsoundDeactivate
function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode ==Enum.KeyCode.R then
if activate.Value ==true then
print("Ration Kirin")
else
print("SharinganFalse")
end
end
if inputObject.KeyCode == Enum.KeyCode.F then
if activate.Value==false then
this
humanoid.WalkSpeed = 0
activate.Value = true
ActivateSound.TimePosition = 0
ActivateSound.Playing = true
local Smoke = Instance.new("Smoke",torso)
Smoke.Color = Color3.new("Black")
local Smoke2 = Instance.new("Smoke",torso)
Smoke.Color = Color3.new("Really red")
local Circle = Instance.new("Part",torso)
local TorsoPosition = torso.Position
Circle.Position = Vector3.new(TorsoPosition) --THIS IS WERE I NEED HELP ON!--
Circle.Shape = "Cylinder"
Circle.Anchored = true
Circle.Orientation = Vector3.new(-0.02, 15.94, 87.05)
Circle.Size = Vector3.new(126, 7, 15)
Circle.BrickColor = BrickColor.new("Really red")
Circle.CanCollide = false
wait(0.5)
Circle.Size = Vector3.new(2, 57, 67)
Circle.BrickColor = BrickColor.new("Black")
wait(1)
humanoid.WalkSpeed = 25
Circle:Destroy()
Smoke:Destroy()
Smoke:Destroy()
Image1.Visible = true
Jutsu1.Visible = true
else
humanoid.WalkSpeed = 16
activate.Value = false
DeactivateSound.TimePosition = 0
DeactivateSound.Playing = true
Image1.Visible = false
Jutsu1.Visible = false
end
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)

3 comments
could you by any chance clean up your code a bit. it's too hard to read
Ok
I put a comment next to the part were I need help on