First of all, hi!
I’m making a combat system which uses remote events, where I send informations to the server like:
The player pressed a button
Activate debounce in a player
etc…
The problem is that I use int. string and a lot of value types for this, and when I want, for example, compare 2 numbers but what is a string in that fire, it warns an error because you can’t compare a string and an int, if that makes sense.
Example of what I’m trying to say:
LocalScript
local event = game:GetService("ReplicatedStorage").RemoteEvents.NormalStandClick
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(input, gpe)
if input.KeyCode == Enum.KeyCode.E then
event:FireServer(1)
elseif input.KeyCode == Enum.KeyCode.Q then
event:FireServer("I am a string")
end
end)
script
local event = game:GetService("ReplicatedStorage").RemoteEvents.NormalStandClick
event.OnServerEvent:Connect(function(player, what)
if what <= 3 then --this gives error because sometimes what = string sometimes what = int
print("Hello")
elseif what == "I am a string" then
print(what)
end
end)
So, is there any way to know if what
is a string or what
is an int?
Thanks for reading.