How do I make mouse.Button1Down in the server script?

Local:

local mouse = game.Players.LocalPlayer:GetMouse()

mouse.Button1Down:Connect(function()
	local t = mouse.Target
	local block = t.Name
	if mouse.Target ~= nil and block == "testBlock" then   
		print("-Hp")
		t:WaitForChild("Health").Value -= 1
	end
end)

Script:

local health = script.Parent.Health

local function change()
	print(health.Value)
end

health.Changed:Connect(change)

So what’s the task? I want to print something when you click on a block (and in the future to change color). ONLY I want it to be visible to all players. To do this I need to use the server script, right?

I guess so, but then how do I make that local script a server script? Because otherwise, my server script can’t see changes in IntValue, so what should I do?

2 Likes

You need to use remote events, I recommend you learning about them on tutorials or any guide, that’s your solution

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.