Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Remote Events/Functions or Regular scripts for my tool to be most efficient?

Asked by 5 years ago

I have been working on a magic local script, and I realized I'd have to use remote functions/events for it to be visible to others. I'm not sure whether to convert it to a regular script or have it be local, I also heard using remote functions/events use bandwidth? Sorry if I'm not making too much sense, I'm fairly new to scripting.

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local enabled = true

mouse.KeyDown:connect(function(key)
    if not enabled then return end
    if key == "e" then
        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://3467593774"
        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.CFrame = CFrame.new(player.Character.Torso.Position)
        projectileVelo.Velocity = player.Character.Torso.CFrame.lookVector * 150
        local damage = script.damage:Clone()
        damage.Parent = projectile
        projectile.Parent = workspace
        game.Debris:AddItem(projectile, 1.5)
        enabled = false
        wait(2)
        enabled = true
    end
end)
0
I would have all of the magic is a single server script, place it in server script service, and use remote events to call the functions. This would make the game run much more smooth. Despayr 505 — 5y
0
Thanks, I'll try that. ScriptedSouls 5 — 5y

Answer this question