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…