Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why wont the script fire an event to the local script?

Asked by 5 years ago
Edited 5 years ago

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

1 answer

Log in to vote
0
Answered by 5 years ago

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.

0
i solved it with my own script Gameplayer365247v2 1055 — 5y
0
but this wouldnt work since we need a player object Gameplayer365247v2 1055 — 5y
0
Pretty much what I said SoftlockedUnderZero 668 — 5y
0
This script looks like an alvin blox script ngl SuperSamyGamer 316 — 5y
Ad

Answer this question