I’m making an image that is a visualisation of player dash ability on a GUI (cooldown).
And someone said I need a remote event for this, so I made a script that sends signal from client to server, another script on server that sends it back, and script in a GUI that receives message from a server. That last one doesn’t work. It doesn’t even shows any errors.
First code:
local UserInputService = game:GetService("UserInputService")
local replicatedstorage = game:GetService("ReplicatedStorage")
local DashQ = replicatedstorage:WaitForChild("DashQ")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local normalspeed = 80
dashbool = false
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if input.KeyCode == Enum.KeyCode.Q then
if dashbool == false then
DashQ:FireServer()
dashbool = true
humanoid.WalkSpeed = normalspeed * 2
wait(5) --- How long will be active
humanoid.WalkSpeed = normalspeed
wait(6) --- Cooldown
dashbool = false
end
end
end)
Second one:
local replicatedstorage = game:GetService("ReplicatedStorage")
local DashQ2 = replicatedstorage:WaitForChild("DashQ2")
game.ReplicatedStorage.DashQ.OnServerEvent:Connect(function(player, CFrame)
print("signal received server")
DashQ2:FireClient(player)
print("signal sent server")
end)
Last one (not receiveing any signal)
local replicatedstorage = game:GetService("ReplicatedStorage")
local button = script.Parent
local cooldown = script.Parent.cooldown
game.ReplicatedStorage.DashQ2.OnServerEvent:Connect(function(player, CFrame)
print("Signal received Image ")
end)
And my remote events:
How to fix that?