Ice projectile variable in a regular script, but I can't figure out a way to access it in my local script. I've tried understanding FireClient() but for the life of me I just can't. Or would I need a module script for this?(don't know how to use them)
Regular Script:
---------[IceSpike]--------------------------------------------------
local IceSpikeEvent = game.ReplicatedStorage.MagicEvents.IceSpikeEvent
enabled = true
IceSpikeEvent.OnServerEvent:connect(function()
if not enabled then return end
local projectile = Instance.new("Part")
projectile.Size = Vector3.new(2,11,2)
projectile.BrickColor = BrickColor.new("Pastel Blue")
projectile.CanCollide = false
local projectileMesh= Instance.new("SpecialMesh", projectile)
projectileMesh.MeshId = "rbxassetid://3508829528"
projectileMesh.Scale = Vector3.new(1,0.8,1)
local projectileEffect = Instance.new("Smoke", projectile)
local projectileVelo = Instance.new("BodyVelocity", projectile)
projectileVelo.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
projectile.Parent = workspace
game.Debris:AddItem(projectile, 1.5)
enabled = false
wait(2)
enabled = true
end)
Local Script:
local IceSpikeEvent = game.ReplicatedStorage.MagicEvents.IceSpikeEvent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
mouse.KeyDown:connect(function(key)
if key == "e" then
IceSpikeEvent:FireServer()
projectile.CFrame = CFrame.new(player.Character.Torso.Position) --help
projectileVelo.Velocity = player.Character.Torso.CFrame.lookVector * 150
end
end)

1 comment
Thank you so much! It works perfectly, no lag or issues. I didn't realize you could use the player parameter in the server connect function so that's really cool.