#How do I make my GUI change after a remote is fired?

40 messages · Page 1 of 1 (latest)

topaz frost
#

When the player presses q, they will enter a boost mode.This is done by using a remote called Boost.I want to make the GUI change 2 times in a row when the remote is fired.Do I need to make another script or use the boost one?Also I want it to happen only in the client.

#

Im writing the code right now

neat shuttle
#

remote event or remote function ?

topaz frost
#

Remote event

fast ermineBOT
#

studio** You are now Level 1! **studio

topaz frost
#

Im writing the script right now

#

Code:
local Players = game:GetService(“Players”)
local RP = game:GetService(“ReplicatedStorage”)
local remotes = RP.Remotes
local BoostRemote = remotes.Boost

local function all()
local player = game.Players.PlayerAdded wait()
local character = player.Character or player.CharacterAdded wait()
local GuiService = game:GetService(“StarterGui”)
local sha = GuiService:WaitForChild(“PreBoostGui”)
local BoostGui = GuiService:WaitForChild(“BoostGui”)
local glassSound = Instance.new(“Sound)
—(Here sound details like volume and id)—
local crack = Instance.new(“Sound”)
—(Sound details)—
crack:Clone()
crack.Parent = character
crack:Play()
sha.Enabled = true

task.wait(0.2)
crack:Stop()
crack:Destroy()
glassSound:Clone()
glassSound:Play()
sha.Enabled = false
BoostGui.Enabled = true

#

Continuation:

neat shuttle
#

if you want to do something when a remote event is called you need to do this:

local RemoteEvent = path.to.remote:WaitForChild("event")
RemoteEvent.OnServerEvent:Connect(function(player, ...args) -- on .OnClientEvent if in local script
    -- code here
end)
topaz frost
#

local ssound1 = Instance.new(“Sound”)
local ssound2 = Instance.new(“Sound”)
—(Sound details)—
ssound1:Clone()
ssound1.Parent = character
ssound1:Play()

ssound2:Clone()
ssound2.Parent = character
ssound2:Play()

task.wait(6.4)
ssound1:Stop()
ssound2:Stop
BoostGui.Enabled = false
task.wait(0.1)
ssound1:Destroy
ssound2:Destroy

end

remotes.Boost.OnClientEvent:Connect(all)

neat shuttle
#

no problem

#

try it out and tell me wheather it works

topaz frost
#

Ok

#

Like this?

#

It doesn’t work

neat shuttle
#

is there an error?

topaz frost
#

No

neat shuttle
#

also does a script :FireClient() or :FireAllClients() ?

topaz frost
#

I have one

#

I need Fire:Client?

neat shuttle
#

look, you fired the remote event for the server but your sound local script is listening for client fires

fast ermineBOT
#

studio** You are now Level 2! **studio

topaz frost
#

So I write fire:client?

neat shuttle
topaz frost
#

Ok

neat shuttle
#

i think you can only fire from client to server or from server to client

topaz frost
#

I got error argument 1 missing or nil

neat shuttle
# topaz frost

set line 7 to BoostRemote.OnClientEvent:Connect(function() instead of BoostRemote.OnClientEvent:Connect(function(all)

#

then it should work

#

@topaz frost does it work ?

topaz frost
#

Ok im going to check

#

No

#

Does a local script need to fire a client or a normal script?

neat shuttle
#

a local script can fire a server sciprt but i dont know if it can fire another client

topaz frost
#

Not working