Right now players only shoot their projectiles locally, but I want these to be seen and interacted with by others. I’ve tried but i’m having little luck making this into a serverscript. Does anyone know what i’d change and how i’d do this?
localscript inside starterpack:
repeat wait() until game.Players.LocalPlayer
player = script.Parent.Parent
mouse = player:GetMouse()
local Animation = Instance.new("Animation")
Animation.AnimationId = 'rbxassetid://6929860536'
playercolor = player.Character.Torso.BrickColor
local sound = Instance.new("Sound")
local cooldown = false
whilecooldown = false do
mouse.KeyDown:connect(function(key)
if key == "e" then
cooldown = true
local projectile = Instance.new("Part")
sound.Parent = player.Character.Torso
sound.SoundId = 'rbxassetid://4797903038'
bt = Instance.new("BodyThrust")
bf = Instance.new("BodyForce")
bt.Parent = projectile
bf.Parent = projectile
bt.Force = Vector3.new(0, 0, -1000)
bf.Force = Vector3.new(0, 290, 0)
projectile.Size = Vector3.new(1,1,2)
projectile.Position = player.Character.HumanoidRootPart.Position
projectile.Orientation = player.Character.HumanoidRootPart.Orientation
projectile.CanCollide = false
local LoadAnimation = player.Character.Humanoid:LoadAnimation(Animation)
LoadAnimation:Play()
projectile.Parent = game.Workspace
sound:Play()
projectile.Material = ("Neon")
projectile.BrickColor = (playercolor)
wait(1)
projectile:Destroy()
wait(2)
cooldown = false
end
end)
end