How do i make switch that can be activated by client

i wanted to create game for my obby game, but obstacle is the switch, i tried to look up on youtube but i gave up
here is the script

serve rscript inside switch

local remote = game.ReplicatedStorage.switchactivate

script.Parent.Touched:Connect(function(hit)
	if game.Players:GetPlayerFromCharacter(hit.Parent) then
		remote:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent))
	end
end)

Player localscript

local switch = workspace.switcher
local block = workspace.switches.Part
local debounce = false
local sfx = switch.pswitch
local pos = switch.Position
local remote = game.ReplicatedStorage.switchactivate

remote.OnClientEvent:Connect(function()
	
	sfx:Play()
	switch.Size = Vector3.new(0.6, 2, 2)
	switch.Position = Vector3.new(94.599, 14.869, -80.456)
	debounce = true
	block.CanCollide = true
	block.SelectionBox.Transparency = 1
	block.Transparency = 0
	wait(13)
	script.Parent.Size = Vector3.new(2, 2, 2)
	script.Parent.Position = pos
	block.CanCollide = false
	block.SelectionBox.Transparency = 0
	block.Transparency = 1
	debounce = false
	
end)

UPDATE: FIXED IT NOW…

What exactly do you want to do? Do you want it to be activated for everyone when a local player interacts with the lever, or do you want it to be different for everyone?

1 Like

never mind i figured it out
i have to just replace the dots by workspace:waitforchild() instead of workspace.object

1 Like

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