So I am trying to make some gui, when I input a players name, then I press the button. I will give a tool to that player in the textbox. So, I am using a remote event and I am transferring variables, when trying to do something it detects it as instance, but it is supposed to be string. When I print the variables, it prints the value correctly.
Local script (In the Gui)
local debounce = false
local food = script.Parent.Parent.Frame.TextLabel.Text
script.Parent.TextButton.MouseButton1Click:Connect(function(clicked)
if debounce == false and script.Parent.Parent.Parent.Parent.Selected.Text == "N/A" then
script.Parent.Parent.Parent.Parent.ERROR.Visible = true
wait(1.5)
script.Parent.Parent.Parent.Parent.ERROR.Visible = false
elseif debounce == false then
debounce = true
local food = script.Parent.Parent.Frame.TextLabel.Text
local targetuser = script.Parent.Parent.Parent.Parent.Selected.Text
local staff = game:GetService("Players").LocalPlayer.Name
game:GetService("ReplicatedStorage").ServingSystem:FireServer(food, targetuser, staff)
script.Parent.Parent.Parent.Parent.SUCCESS.Visible = true
wait(1)
debounce = false
wait(0.5)
script.Parent.Parent.Parent.Parent.SUCCESS.Visible = false
end
end)
Normal script (SSS)
game:GetService("ReplicatedStorage").ServingSystem.OnServerEvent:Connect(function(...)
local args = {...}
local selectedplayer = args[1]
local selectedfood = args[2]
local staffname = args[3]
print(selectedplayer)
print(selectedfood)
print(staffname)
local targetbackpack = game.Players[selectedplayer].Backpack
local newfood = game.ReplicatedStorage.FoodStorage[selectedfood]:Clone()
newfood.Parent = targetbackpack
print(staffname.." gave "..selectedplayer.." "..selectedfood)
end)

3 comments
Kinda messed up the code.
The LUA thing ^
can u specify where the error is