The below script is a server script parented inside a part and the goal im trying to do is simple. I just want the "Timer_Pause" and "Timer_Start" parts to move when clicked on the button using a remote event getting recieved by a local script.
but I keep getting the error Fireclient: Player arguement must be a player object at Line: 24
local button = script.Parent.SurfaceGui.TextButton
local text = button.Parent.TextLabel
local rep = game:GetService("ReplicatedStorage")
local event1 = rep:WaitForChild("MoveParts1")
local event2 = rep:WaitForChild("MoveParts2")
local timestart = script.Parent.Parent:WaitForChild("Timer_Start")
local timepause = script.Parent.Parent:WaitForChild("Timer_Pause")
local db = true
button.MouseButton1Click:Connect(function(player)
if db == true then
db = false
text.Text = "Speedrun mode: ON"
text.TextColor3 = Color3.fromRGB(5, 213, 12)
button.Text = "ON"
button.BackgroundColor3 = Color3.fromRGB(12, 255, 0)
button.TextColor3 = Color3.fromRGB(8, 122, 0)
event1:FireClient(player) -- error line ----------------------------
elseif db == false then
db = true
text.Text = "Speedrun mode: OFF"
text.TextColor3 = Color3.fromRGB(255, 0, 0)
button.Text = "OFF"
button.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
button.TextColor3 = Color3.fromRGB(140, 0, 0)
event2:FireClient(player) -- also error line but it doesnt reach it
end
end)
Local script (no errors here)
Parent: StarterPlayerScripts
local replicatedStorage = game:GetService("ReplicatedStorage")
local event1 = replicatedStorage:WaitForChild("MoveParts1")
local event2 = replicatedStorage:WaitForChild("MoveParts2")
local daily = game.Workspace:WaitForChild("DailyChallenge")
local timestart = daily.Timer_Start
local timepause = daily.Timer_Pause
event1.OnClientEvent:Connect(function()
timestart.Position = Vector3.new(43821.449, 1452.641, 7168.538)
timepause.Position = Vector3.new(43833.625, 1452.818, 7168.822)
end)
event2.OnClientEvent:Connect(function(timestart, timepause)
timestart.Position = Vector3.new(43821.449, 1452.641, 8085.539)
timepause.Position = Vector3.new(43833.625, 1452.818, 9536.326)
end)

3 comments
There's no player parameter in the MouseButton1Click event.
You can only detect if a button was pressed on the client only(LocalScript)
thx yall