I'm trying to code a simple outline for a block that infects you with a virus, and I'm trying to send the server script to a LocalScript for easier changing of player values, etc.
My current script (which is inside of the part that you need to walk on) is this:
--Variables
local Players = game:GetService("Players")
local pressed = false
--Script
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if not pressed then
pressed = true
local chance = math.random(1,10)
local incubation = math.random(60, 120)
print("FVZ-112 Script Fired.")
local event = Instance.new("RemoteEvent")
event.Parent = game.ReplicatedStorage.Viruses.FVZ112
event.Name = "onTouched"
print("Event Defined.")
local function onTouched(player)
event:FireClient(player)
end
script.Parent.Touched:Connect(onTouched)
print("Event Fired")
wait(5)
pressed = false
end
end
end)
The problem is that when I step on the button, in the output it says "FireClient: player argument must be a Player object"
I know that the incubation and chance values aren't doing anything currently, but I'll implement them once I've made sure the script works.

1 comment
try changing the remote event name, the name of an object can interfere with the script. such as naming an object Color.