server script
local tweenService = game:GetService("TweenService")
local door1 = script.Parent.Door1
local door2 = script.Parent.Door2
local detector1 = script.Parent.Detector1
local detector2 = script.Parent.Detector2
local tweeningInformation = TweenInfo.new(
2, -- Length
Enum.EasingStyle.Linear, -- Easing style of the TweenInfo
Enum.EasingDirection.Out, -- Easing direction of the TweenInfo
0, -- Number of times the tween will repeat
false, -- Should the tween repeat?
0 -- Delay between each tween
)
local door1close = {
CFrame = CFrame.new(-768.19, 5.14, -97.06)
}
local door1open = {
CFrame = CFrame.new(-760.928, 5.14, -97.06)
}
local door2close = {
CFrame = CFrame.new(-775.44, 5.14, -97.06)
}
local door2open = {
CFrame = CFrame.new(-782.624, 5.14, -97.06)
}
local tween1open = tweenService:Create(door1,tweeningInformation,door1open)
local tween1close = tweenService:Create(door1,tweeningInformation,door1close)
local tween2open = tweenService:Create(door2,tweeningInformation,door2open)
local tween2close = tweenService:Create(door2,tweeningInformation,door2close)
--detector1.Touched:Connect(function(hit)
--if hit.Parent:FindFirstChild("HumanoidRootPart") then
-- print("touched")
-- tween1open:Play()
-- tween2open:Play()
-- wait(2)
-- tween1close:Play()
-- tween2close:Play()
--end
--end)
detector2.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("HumanoidRootPart") then
game.ReplicatedStorage:WaitForChild("Rank"):FireClient()
game.ReplicatedStorage:WaitForChild("Detector1").OnServerEvent:Connect(function()
tween1open:Play()
tween2open:Play()
wait(2)
tween1close:Play()
tween2close:Play()
end)
game.ReplicatedStorage:WaitForChild("Detector1kill").OnServerEvent:Connect(function()
hit.Parent.Humanoid.Health = 0
end)
end
end)
detector1.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("HumanoidRootPart") then
game.ReplicatedStorage:WaitForChild("Rank"):FireClient()
game.ReplicatedStorage:WaitForChild("Detector1").OnServerEvent:Connect(function()
tween1open:Play()
tween2open:Play()
wait(2)
tween1close:Play()
tween2close:Play()
end)
game.ReplicatedStorage:WaitForChild("Detector1kill").OnServerEvent:Connect(function()
hit.Parent.Humanoid.Health = 0
end)
end
end)
--game.ReplicatedStorage:WaitForChild("Detector1").OnServerEvent:Connect(function()
-- tween1open:Play()
-- tween2open:Play()
-- wait(2)
-- tween1close:Play()
-- tween2close:Play()
--end)
--game.ReplicatedStorage:WaitForChild("Detector1kill").OnServerEvent:Connect(function()
--end)
error: Argument 1 missing or nil
15:35:47.464 - Stack Begin
15:35:47.465 - Script 'Workspace.Door.move_doors', Line 64
15:35:47.465 - Stack End
i only touched detector2
At the line game.ReplicatedStorage:WaitForChild(“Rank”):FireClient()
:FireClient()
needs an argument called the player to activate their local scripts.
Ie.
:FireClient(chloe_price65)
Note that the first argument needs to be a player and not a string.