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

Help Understanding RemoveEvent's?

Asked by 9 years ago

So I read the wiki article on RemoteEvent's, but it didn't really explain in the ways you can use it. So I wanted to do a few test with, I started off by creating a Cash Register. Then made the RemoteEvent in ReplicatedStorage, and then make a server script.

The way I was trying to use it was to send information to the server script so I could then use it in that script. The problem is when I fire it and try printing the information sent, it doesn't work. I never have used RemoteEvent's so I wanted to know if I'm doing this correctly?

Inside Register | Normal Script | Not all of the script

local RegisterNum = 1
local CurrentCustomer = nil
local OrderRemote = game.ReplicatedStorage:FindFirstChild("CustomerServed")

function CheckCustomers(Place)
    for _,v in pairs(Place:GetChildren()) do
        local hum = v:FindFirstChild("Humanoid")
        if hum then
            local Selected = v:FindFirstChild("Selected")
            if Selected then
                if Selected.Value == "Location_"..RegisterNum then
                    CurrentCustomer = v
                    break
                end
            end
        end
    end
end

ClickDetector.MouseClick:connect(function()
CheckCustomers(game.Workspace)
if CurrentCustomer then
OrderRemote:FireServer(RegisterNum, CurrentCustomer, "Order")
end
end)

Inside ServerScriptService | Normal Script | Not all of the script

local OrderRemote = game.ReplicatedStorage:FindFirstChild("CustomerServed")

OrderRemote.OnServerEvent:connect(function(Register, Customer, Order)
    print("Register #"..Register.." | Customer: "..Customer.." | Ordering: "..Order)
end)

Error | ServerScript

ServerScriptService.Script:4: attempt to concatenate local 'Register' (a userdata value)

Am I doing something wrong? If someone could help, it would mean a lot to me!

0
The error is on line 33 of the script, a line which we don't have. RaverKiller 668 — 9y
0
Yes you do, print("Register #"..Register.." | Customer: "..Customer.." | Ordering: "..Order) is the line. "Not all of the script" YasuYoshida 171 — 9y

Answer this question