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

How would I make this script fire a remote event so everyone can see its effects?

Asked by 5 years ago

I'm trying to make an ultra instinct script (from dbs) but the issue with the script is it's a local script so no one but me can see the effects (particles, and parts), and I heard some users to say "Use remote events" but I'm so confused on how they work.

Code I'm using (it's in a local script)

player = game.Players.LocalPlayer
character = player.Character
hmndrootpart = character:FindFirstChild("HumanoidRootPart")

local muiaura1 = script.Parent.particle:WaitForChild("muiaura1")
local muiaura2 = script.Parent.particle:WaitForChild("muiaura2")
local muiaura3 = script.Parent.particle:WaitForChild("muiaura3")
local muidot = script.Parent.particle:WaitForChild("muidot")

game.Workspace.ssj.Disabled = true
game.Workspace.ssg.Disabled = true
game.Workspace.ssgss.Disabled = true
game.Workspace.ssgsskx10.Disabled = true
game.Workspace.kaioken.Disabled = true
game.Workspace.baseform.Disabled = true

wave2 = Instance.new("Part")
mesh = Instance.new("SpecialMesh", wave2)
wave = Instance.new("Part")
wave3 = Instance.new("Part")

mesh.MeshId = "http://www.roblox.com/asset/?id=3270017"
mesh.Offset = Vector3.new(0, 0, -80)
wave.Parent = game.Workspace
wave.Size = Vector3.new(0.05, 0.05, 0.05)
wave.CanCollide = false
wave.Anchored = true
wave.Position =     hmndrootpart.Position
wave.Color = Color3.fromRGB(255, 255, 255)
wave.Shape = Enum.PartType.Ball
wave.Material = Enum.Material.Neon
wave2.Parent = game.Workspace
wave2.Size = Vector3.new(0.05, 0.05, 0.05)
wave2.CanCollide = false
wave2.Color = Color3.fromRGB(255, 255, 255)
wave2.Anchored = true
wave2.Position = hmndrootpart.Position
wave2.Material = Enum.Material.SmoothPlastic
wave2.Orientation = Vector3.new(90, 0, 0)
wave3.Parent = game.Workspace
wave3.Size = Vector3.new(2048, 1, 16)
wave3.CanCollide = false
wave3.Color = Color3.fromRGB(255, 255, 255)
wave3.Anchored = true
wave3.Position = hmndrootpart.Position
wave3.Material = Enum.Material.Neon
wave3.Shape = Enum.PartType.Cylinder
wave3.Orientation = Vector3.new(0, 0, 90)
script.Parent.Handle.muimusicbefore:Play()
script.Parent.Handle.mui:Play()
for i = 1, 200 do
        wave.Size = wave.Size + Vector3.new(2, 2, 2)
        mesh.Scale = mesh.Scale + Vector3.new(8, 8, 2)
        wave.Transparency = wave.Transparency + 0.01
        wave2.Transparency = wave2.Transparency + 0.01
        mesh.Scale = mesh.Scale + Vector3.new(1, 1, 0)
        wave3.Transparency = wave3.Transparency + 0.01
        wave3.Size = wave3.Size + Vector3.new(0, 1, 1)
        wait(0.01)
end
wave2:Destroy()
wave:Destroy()
wave3:Destroy()
script.Parent.Handle.muisound:Play()
script.Parent.Handle.Mesh.MeshId = "rbxassetid://1125231485"
script.Parent.Handle.ssgssaura.Enabled = false
script.Parent.Handle.ssgaura.Enabled = false
script.Parent.Handle.ssjaura.Enabled = false
script.Parent.Handle.kx10aura.Enabled = false
muiaura1.Enabled = true
muiaura2.Enabled = true
muiaura3.Enabled = true
muidot.Enabled = true
script.Parent.Handle.Color = Color3.fromRGB(163, 162, 165)
script.Parent.AttachmentForward = Vector3.new(0, 0, 1)
script.Parent.AttachmentPos = Vector3.new(0, -0.5, -0.1)
script.Parent.AttachmentRight = Vector3.new(-1, 0, 0)
script.Parent.AttachmentUp = Vector3.new(0, 1, 0)
script.Parent.Handle.Mesh.Scale = Vector3.new(6, 6, 6)
script.Parent.Handle.ssj:Stop()
script.Parent.Handle.ssg:Stop()
script.Disabled = true
game.Workspace.ssj.Disabled = false
game.Workspace.ssg.Disabled = false
game.Workspace.ssgss.Disabled = false
game.Workspace.ssgsskx10.Disabled = false
game.Workspace.kaioken.Disabled = false
game.Workspace.baseform.Disabled = false
wait(60)
script.Parent.Handle.muimusicafter:Play()

I really need help with remote events, tutorials are still to confusing for me.

0
search in youtube there are so many tutorials about remote events, I'd like to help you but I'm so bad to teach Xx_XSanderPlayXx 160 — 5y
0
youtube doesn't help at all LoganboyInCO 150 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

So, since most changes made on the client gets rejected in an actual game due to the implementation of FE. However, the server can still communicate with the client and vice versa. Doing this sometimes involves the use of remote events, usually put into replicated storage, or a tool. the remote event has three main functions FireClient(),FireAllClients(), and FireServer(). FireClient and FireAllClients allows the server to communicate to the client and FireServer allows the client to communicate with the server. To achieve what you seem to want to do, the use of FireServer is best.

The first important step is to make a remote event and put it in the tool , name it anything you like, but for this demo, I'm just going to call it "Event"

--local script in the tool
local event = script.Parent:WaitForChild("Event")
local tool = script.Parent

tool.Activated:Connect(function()--when the player clicks the mouse when holding the tool
    event:FireServer("Demo")
end)

Note: if you want the remote event to serve multiple purposes, i suggest using a command argument that tells it the purpose of the fireclient/fireserver/fireallclients.

--server script also in tool
local event = script.Parent:WaitForChild("Event")

event.OnServerEvent:Connect(function(player,...)
    local args = {...}--makes a table of all the other arguments
    if args[1] == "Demo" then
        --do stuff here, I'm just going to do an example of what can be done
        local part = Instance.new("Part")
        part.Parent = workspace
        part.Name = "TestPart"
        part.Color = Color3.FromRGB(255,5,60)
        local particle = Instance.new("ParticleEmitter")
        particle.Parent = part
    end
end)

Note: ... is used to represent all arguments at and after the position of the ...

Hopefully this clears up some uncertainties about remote events

0
I see, the thing I'm trying to make though is chat activated (activated by chat command) also its a hat and not a tool. LoganboyInCO 150 — 5y
0
try looking at the scripts of your character when you spawn in and see how roblox lets you do /e wave or /e dance theking48989987 2147 — 5y
0
wdym (what do you mean) LoganboyInCO 150 — 5y
Ad

Answer this question