#RemoteInvoke Problems
163 messages · Page 1 of 1 (latest)
im talking to another guy
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Mouse = Player:GetMouse()
local UIS = game:GetService("UserInputService") -- Load button systyem.
local Server = game.ReplicatedStorage.Server -- Looks for the remote function.
local Debounce = false -- Defaults
local Equipped = false
local Chargerr = false
local balls = "Crippled"
local Fireball = game.ReplicatedStorage.Assets.Fireball
UIS.InputBegan:Connect(function(input, GPE)
if GPE then
return
end
if input.KeyCode == Enum.KeyCode.F and not Chargerr then
Server:InvokeServer("Fireball", "Charge", {})
Chargerr = true
local Charge = 0
local BG = Instance.new("BodyGyro", Character.HumanoidRootPart) --Turning while charging!
BG.CFrame = CFrame.new(Character.HumanoidRootPart.Position, Mouse.Hit.Position) --Targets mouse.
BG.MaxTorque = Vector3.one * 99999 --Max force.
BG.P = 3000 --Power.
BG.D = 100 --Dammpening.
BG.Name = "Align" --Named "align" for easy use.
local BP = Instance.new("BodyPosition", Character.HumanoidRootPart)
BP.Position = Character.HumanoidRootPart.Position
BP.MaxForce = Vector3.one * 99999
BP.P = 3000
BP.D = 100 --------------------------------Prevents player from moving.
BP.Name = "Position"
print(Chargerr)
repeat
Charge += 1
BG.CFrame = CFrame.new(Character.HumanoidRootPart.Position, Mouse.Hit.Position) --Targets mouse.
task.wait()
until Chargerr == false
Server:InvokeServer("Fireball", "Fire", {Charge = Charge, CFrame = Character.HumanoidRootPart.CFrame,EndPos = Mouse.Hit.Position})
BG:Destroy()
BP:Destroy()
end
end)
UIS.InputEnded:Connect(function(input, GPE)
if input.KeyCode == Enum.KeyCode.F then
Chargerr = false
end
end)
First script
local Server = game.ReplicatedStorage.Server
Server.OnServerInvoke = function(Client, Set, Skill, Data)
Data.Character = Client.Character
for i, Player in pairs(game.Players:GetPlayers()) do
if (Player.Character.HumanoidRootPart.Position-Client.Character.HumanoidRootPart.Position).Magnitude < 125 then
Server:InvokeClient(Player,Set,Skill,Data)
end
end
end
Server managing thing
oh god im not that advanced
local Server = game.ReplicatedStorage.Server
local Effects = {}
for i, Module in pairs(script:GetChildren()) do
Effects[Module.Name] = require(Module)
Module:Destroy()
end
Server.OnClientInvoke = function(Set,Effect,Data)
Effects[Set][Effect](Data)
end
Replicator
local module = {}
function module.Charge(Data)
local Character = Data.Character
local Charge = game.ReplicatedStorage.Assets.Fireball.Charge:Clone()
end
return module
module
no clue
THE FUCK
Server:InvokeServer("Fireball", "Charge", {})
Chargerr = true
local Charge = 0
local BG = Instance.new("BodyGyro", Character.HumanoidRootPart) --Turning while charging!
BG.CFrame = CFrame.new(Character.HumanoidRootPart.Position, Mouse.Hit.Position) --Targets mouse.
BG.MaxTorque = Vector3.one * 99999 --Max force.
BG.P = 3000 --Power.
BG.D = 100 --Dammpening.
BG.Name = "Align" --Named "align" for easy use.
local BP = Instance.new("BodyPosition", Character.HumanoidRootPart)
BP.Position = Character.HumanoidRootPart.Position
BP.MaxForce = Vector3.one * 99999
BP.P = 3000
BP.D = 100 --------------------------------Prevents player from moving.
BP.Name = "Position"
print(Chargerr)
repeat
Charge += 1
BG.CFrame = CFrame.new(Character.HumanoidRootPart.Position, Mouse.Hit.Position) --Targets mouse.
task.wait()
until Chargerr == false
Server:InvokeServer("Fireball", "Fire", {Charge = Charge, CFrame = Character.HumanoidRootPart.CFrame,EndPos = Mouse.Hit.Position})
BG:Destroy()
BP:Destroy()
WHY THE FUCK IS ALL OF THIS HERE!!!

all of this is static data!
💅
you're redefining it every single time you press the fucking key
AHHHHHHHHHHHHHH
dies of death
So
okay did you print debbuged here?
local Server = game.ReplicatedStorage.Server
Server.OnServerInvoke = function(Client, Set, Skill, Data)
print(Client, Set, Skill, Data)
Data.Character = Client.Character
for i, Player in pairs(game.Players:GetPlayers()) do
if (Player.Character.HumanoidRootPart.Position-Client.Character.HumanoidRootPart.Position).Magnitude < 125 then
Server:InvokeClient(Player,Set,Skill,Data)
end
end
end
no
Server:InvokeServer("Fireball", "Fire", {Charge = Charge, CFrame = Character.HumanoidRootPart.CFrame,EndPos = Mouse.Hit.Position})
this bad
you're giving your game to hackers
dude, actually burn this shite with fire
no wonder roblox games are all fucked up -_-
k
RUDE
print debug the parameters
@jaunty ferry
if they are nil the problem is in the client
you're sending nil data
NO
Client.Character.HumanoidRootPart.Position).Magnitude < 125 then
Server:InvokeClient(Player,Set,Skill,Data)
WHAT IS HE DOING
NOOOOO

ONG
Server:InvokeClient(Player,Set,Skill,Data)
@latent ledge
Dude look at this shit
MF LITERALLY CRASHING THE MODULE IF THE PLAYER LEAVESSS
ooooof
prints everything
print(Client, Set, Skill, Data)
then you don't have a data problem, the problem is in the transforms
Players.renars27.PlayerScripts.LocalScript:10: attempt to index nil with 'Charge'
0kay give me the server invoke code
with a comment in the error line
so I can know
🙂
line 10
server
read what I just sent 😄
error line comment
i don't understand
what you mean
just send me the server code with a comment in the error line
what's so hard about that
😅
local Server = game.ReplicatedStorage.Server
Server.OnServerInvoke = function(Client, Set, Skill, Data)
print(Client,Set,Skill,Data)
Data.Character = Client.Character
for i, Player in pairs(game.Players:GetPlayers()) do
if (Player.Character.HumanoidRootPart.Position-Client.Character.HumanoidRootPart.Position).Magnitude < 125 then
Server:InvokeClient(Player,Set,Skill,Data)
end
end --i love big oily men
end
yes
wait
local Server = game.ReplicatedStorage.Server
local Effects = {}
for i, Module in pairs(script:GetChildren()) do
Effects[Module.Name] = require(Module)
Module:Destroy()
end
Server.OnClientInvoke = function(Set,Effect,Data)
Effects[Set][Effect](Data)
end
you mean this script
I mean whichever script that is giving you the error
with a comment in line 10
which is were the output marks the error
yeah this one then
Effects[] thing
and what was the error again?
indexing with nil
index nil with data?
attempt to index nil with 'Charge'
mhm
Effects[Set] that set is nil
it does not exist
look in your player Sets data table
and make sure it's there
that's the error
where is that table, Only God knows
look for it, add the Set you're asking for
and it should work
In this case you're sending either Fire or Fireball
as the set
so yup that
huh
local Server = game.ReplicatedStorage.Server
Server.OnServerInvoke = function(Client, Set, Skill, Data)
print(Client,Set,Skill,Data)
Data.Character = Client.Character
for i, Player in pairs(game.Players:GetPlayers()) do
if (Player.Character.HumanoidRootPart.Position-Client.Character.HumanoidRootPart.Position).Magnitude < 125 then
Server:InvokeClient(Player,Set,Skill,Data)
end
end
end
so
The set does print when invoked
but when it invokes the client
things to note:
- This code is very badly designed
- This code is very unsafe, you're invoking the client and it's also sending you data you could re-design for the server to know alreadty
- This code is very inneficient, unnecessary loops, and data re-delcaration
- This code is making request to multiple scripts that are part of the same system, you have TOO MUCH abstraction
it does not
OH
you print what the client is sending you
you're not printing the set
Effects[Set][Effect](Data)
this is your set
Effects[Set]
^ whatever is the key you're using
is nil
does not exist in the Effects table
^ do note this, you're not learning anything really useful aside from actually making a game and hopefully finishing it, and gonna develop some very stupid and nasty habits, but is part of learning.
but you should not use this to learn this is absolutely botched
but definitely finish the lil project
Thanks for the help

