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

Why does this script not continue on from line 7 when fired from a remote event?

Asked by
bailley5 114
2 years ago

Server Script: (the one where it stops at line 7)

game.ReplicatedStorage.IceFire.OnServerEvent:Connect(function(plr)
    local icering = game.ReplicatedStorage.IceRing:Clone()

    icering:SetPrimaryPartCFrame(plr.Character.HumanoidRootPart.CFrame) -- teleporting the icering to the player

    icering.Parent = workspace 
    plr.Character.HumanoidRootPart.CFrame = icering.PlayerTp.CFrame -- teleporting the player above the icering
    print("Continuing")
    wait(0.1)
    plr.Character.LowerTorso.Anchored = true -- anchoring the player so they dont fall
    wait(1)



    icering.Sound.Playing = true -- explosion sound

    local Info = TweenInfo.new(3,Enum.EasingStyle.Cubic,Enum.EasingDirection.Out,0,false,0)

    local Goals = {Size=Vector3.new(50,50,50)}-- the size to tween to

    for i, v in pairs(workspace.IceRing:GetDescendants()) do

        if v:IsA("BasePart") then
            v.Touched:Connect(function(touch)
                if touch.Parent:FindFirstChild("Humanoid") then
                    if not plr then
                        touch.Parent.Humanoid.Health -= 100
                    end
                end
            end)

            local tween = game:GetService("TweenService"):Create(v,Info,Goals)
            tween:Play()

            tween.Completed:Connect(function()
                plr.Character.LowerTorso.Anchored = false
                icering:Destroy()
            end)
        end
    end
end)

Local Script: (Fires a remote to the server when a player presses "E")

local inputservice = game:GetService("UserInputService")
local debounce = false

inputservice.InputBegan:Connect(function(input, isTyping)
    if not debounce then
    if input.KeyCode == Enum.KeyCode.E then
            debounce = true
            game.ReplicatedStorage.IceFire:FireServer()
            wait(6)
            debounce = false
            end
    end
end)
0
It tps the player above the ice then stops continuing the script bailley5 114 — 2y

1 answer

Log in to vote
1
Answered by
enes223 327 Moderation Voter
2 years ago

I told this on another question too, you need to use the built-in function named "SetPrimaryPartCFrame" on the character as you used it on ice ring, just do this instead of setting the CFrame by yourself:

plr.Character:SetPrimaryPartCFrame(icering.PlayerTp.CFrame)
Ad

Answer this question