Does anyone know how I would turn this into a serverscript?

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 ="Animation")
Animation.AnimationId = 'rbxassetid://6929860536'
playercolor = player.Character.Torso.BrickColor
local sound ="Sound")
local cooldown = false

whilecooldown = false do
		if key == "e" then
			cooldown = true
			local projectile ="Part")
			sound.Parent = player.Character.Torso
			sound.SoundId = 'rbxassetid://4797903038'
			 bt ="BodyThrust")
			 bf ="BodyForce")
			bt.Parent = projectile
			bf.Parent = projectile
			bt.Force =, 0, -1000)
			bf.Force =, 290, 0)
			projectile.Size =,1,2)
			projectile.Position = player.Character.HumanoidRootPart.Position
			projectile.Orientation = player.Character.HumanoidRootPart.Orientation
			projectile.CanCollide = false
			local LoadAnimation = player.Character.Humanoid:LoadAnimation(Animation)
			projectile.Parent = game.Workspace
			projectile.Material = ("Neon")
			projectile.BrickColor = (playercolor)
			cooldown = false

1 Like

Oh yeah i’m using them for player health, I was just dumb and didn’t think about it here whoops


Do you know where I would start the event and what I would have after it is started?

A lot of the stuff i’d want to do in the event requires things I made before I would fire it, I just don’t know what I would have to change and I don’t know if all of that is stuff compatible with a server script too

I still don’t get what you mean, would I need to set up all those things above “== e” again in my server script? All the code inside of that is completely dependent on things I created before the keypress