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

The remote event wont fire and i have no idea how to fix this?

Asked by
Dec_ade 47
4 years ago
local plr = game.Players.LocalPlayer
local char = plr.Character
local UIS = game:GetService("UserInputService")
local Mouse = plr:GetMouse()
---------------------------------------------
local RP = game:GetService("ReplicatedStorage")
local Remote = RP.FireBallRemote
--------------------------------------
local Debounce = true
local Key = "Z"
local ButtonDown = false

UIS.InputBegan:Connect(function(Input, IsTyping)
    if IsTyping then return end
    local KeyPressed = Input.KeyCode if KeyPressed == Enum.KeyCode[Key] and Debounce and char then
        Debounce = false
        ButtonDown = true
        Remote:FireServer(ButtonDown, Mouse.Hit,UIS)
        print("fired")
    end 
end)

1 answer

Log in to vote
0
Answered by
iuclds 720 Moderation Voter
4 years ago

Client

local plr = game.Players.LocalPlayer
local char = plr.Character
local UIS = game:GetService("UserInputService")
local Mouse = plr:GetMouse()
---------------------------------------------
local RP = game:GetService("ReplicatedStorage")
local Remote = RP.FireBallRemote
--------------------------------------
local Debounce = true
local Key = "Z"
local ButtonDown = false

UIS.InputBegan:Connect(function(Input, IsTyping)
    if IsTyping then return end
    local KeyPressed = Input.KeyCode if KeyPressed == Enum.KeyCode[Key] and Debounce and char then
        Debounce = false
        ButtonDown = true
        Remote:FireServer(ButtonDown, Mouse.Hit,UIS)
        print("fired")
    end 
end)

Server

local UIS = game:GetService("UserInputService")
Remote.OnServerEvent:Connect(function(Player,Down,HitPosition)
    -- code here
end)
0
thx i will try this Dec_ade 47 — 4y
0
player is always the first variable in a remote iuclds 720 — 4y
Ad

Answer this question