Okay. So we know the problem is with the print. On the server. Try removing that print for now.
It appears to still be unable to get the player, for some reason.
removing the print didn’t do anything it seems.
Anyways, it’s getting late for me, so I’m gonna head to bed.
I can’t tell what the issue is, but I’ll just leave the two scripts in their current state in case anyone else will be able to tell what’s going on.
localscript:
local stor = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
local elc = stor.at
script.Parent.MouseButton1Click:Connect(function()
print("Registered")
local e = elc:InvokeServer()
player.PlayerGui.register.Enabled = false
if e == true then
print("works")
end
end)
serverscript:
local stor = game:GetService("ReplicatedStorage")
local elec = stor.Election
local elc = stor.at
local Electiontable = {
}
local function onFired(player)
if not table.find(Electiontable, player.Name) then
table.insert(Electiontable, player.Name)
return true
end
end
elc.OnServerInvoke = onFired()
Remove the if statement for now
Put the return true outside [inside the function[
same issue, but now with the “table.insert” instead of the “if statement”.
I hope that with a clear head tomorrow, the issue will become obvious like I’ve opened my third eye. goodnight
Remove the table insert aswell, put only ‘return true’ inside onFired function.
Goodnight mate
Of course you could do more stuff with that, but this was demonstrated as a basic method.
Hi I have no idea what you are talkng about but don’t every use table.find or table.insert since it goes from the start of the table all the way through until it finds what it is looking for and if you have a bunch of elections or whateve ryou are doing like Player z is elected itll go through player a,b,c, etc untilit finds z in the table so pls dont do that but instead use something called keyindexing which makes it assume its already there and returns a value.
local table = {}
for _,v in next, game.Players:GetPlayers() do
for i = 1, 100 do--looping for effect
table[plr.Name..tostring(i)] = true
task.wait()
end
end
print(table["TomskiKiller64"]--true and it will only assume its there not looping through the hundreds of things in the table but
--instead returning the value or nil if its not there so if you want
--you could just do something like
if table["TomskiKiller101"] then
--wont run since it only goes to 100 and wont error or anything
--much more effecient then the table functions
end