I feel stupid asking this, cause i should know it, but somehow my game is finding “nil” instead of the value, which even gets listed. Is there something wrong with my “Arguments”?
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local EventsFolder = ReplicatedStorage:FindFirstChild("Events")
local VotingFolder = ReplicatedStorage:FindFirstChild("Voting")
local plrVoted = EventsFolder:FindFirstChild("PlayerVoted")
plrVoted.OnServerEvent:Connect(function(userId, Argument)
if Argument == "Votes1" or "Votes2" or "Votes3" then
print(Argument, userId)
warn(VotingFolder:GetChildren())
warn(VotingFolder:FindFirstChild(Argument)) --wont find me the argument
else return
end
end)
if Argument == "Votes1" or "Votes2" or "Votes3" then is not a valid condition.
You must use Argument == for every single or if Argument == "Votes1" or Argument == "Votes2" or Argument == "Votes3" then
yes, the argument thats getting sent is completely the same as in the code i have provided; here is the one line which sends the event, to prove nothing should be wrong
I think problem here is in FindFirstChild(“”)
Use this instead
local EventsFolder = ReplicatedStorage:WaitForChild("Events")
local VotingFolder = ReplicatedStorage:WaitForChild("Voting")
local plrVoted = EventsFolder:WaitForChild("PlayerVoted")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local EventsFolder = ReplicatedStorage:WaitForChild("Events")
local VotingFolder = ReplicatedStorage:WaitForChild("Voting")
local plrVoted = EventsFolder:WaitForChild("PlayerVoted")
plrVoted.OnServerEvent:Connect(function(userId, Argument)
if Argument == "Votes1" or "Votes2" or "Votes3" then
print(Argument, userId)
warn(VotingFolder:GetChildren())
warn(VotingFolder:WaitForChild(Argument)) --wont find me the argument
else return
end
end)