ok. i made a script that lets you shoot projectiles when you press the key "e" now i need the projectiles to damage npcs on touch. i tried putting every damage script out there in the projectile, nothing worked. heres the script:
local sound = script.fire
local tweenservice = game:GetService("TweenService")
local plr = game.Players.LocalPlayer
local tear1 = game.ReplicatedStorage.Player1tear
local UIS = game:GetService("UserInputService")
UIS.InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
print("Working")
sound:Play()
local clonetear = tear1:Clone()
clonetear.Parent = game.Workspace
clonetear.CFrame = plr.Character.HumanoidRootPart.CFrame + plr.Character.HumanoidRootPart.CFrame.lookVector * 5 tweenservice:Create(clonetear,TweenInfo.new(1,0,0),{CFrame = plr.Character.HumanoidRootPart.CFrame + plr.Character.HumanoidRootPart.CFrame.lookVector * 40,Transparency = 1},Enum.EasingStyle.Quint,Enum.EasingDirection.Out):Play()
game.Debris:AddItem(2.5,clonetear) -- change the number of time to wait until the ball dissapear,this can be the ball range untill get deleted
end
end)
keep in mind: theres a projectile in replicated storage called tear1 theres a sound in the script called fire the localscript in the codeblock goes into starterplayerscripts. any help?????

6 comments
im still a starter so i don't know how to set up remote events. explanation please?
there wasn't any remote events in her answer. basically, remote events can transfer data from client to server, and vice versa.
i meant his
He said in the script --youll need to set up some remote events to deal real damage---
actually i set this script up and it kinda woks. it kills the npc instantly. is thee a way to deal like 10 damage or something?
okay this is interesting. i set up the remote event, and now the projectiles damage me when they touch the npc??????