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

why does my argument that is being passed not pass my new character?

Asked by 2 years ago

here is the script, i make a new character that is then clones into the workspace and remove the old character, however when i pass the arguments to the fire server it still thinks i am in my old character.

local script

local player = game.Players.LocalPlayer
local char = player.Character

local UIS = game:GetService("UserInputService")

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Event = ReplicatedStorage:WaitForChild("run")

local off = ReplicatedStorage:WaitForChild("runoff")

local flash = true
UIS.InputBegan:Connect(function(key)
    if key.KeyCode == Enum.KeyCode.Z then
        flash = not flash
        if flash == false then
            flash= true
            player.Character.Humanoid.WalkSpeed = 60
            local old = game.Players.LocalPlayer.Character
            local new = game.ReplicatedStorage:FindFirstChild("flash"):Clone()
            new:SetPrimaryPartCFrame(old.HumanoidRootPart.CFrame)
            player.Character = new
            new.Parent = game.Workspace
            Event:FireServer(player,new)
        elseif flash == true then
            flash = false
            off:FireServer(player)
        end

    end
end)

server script

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Event = ReplicatedStorage:WaitForChild("run")

local function running(player,new)

    player.Character.Head.trailOuter.Enabled = true
    player.Character.Head.trailInner.Enabled = true
    player.Character.Head.trailLight.Enabled = true
    player.Character.Head.lightningParticle.Enabled = true

    player.Character.UpperTorso.trailOuter.Enabled = true
    player.Character.UpperTorso.trailInner.Enabled = true
    player.Character.UpperTorso.trailLight.Enabled = true
    player.Character.UpperTorso.lightningParticle.Enabled = true

    player.Character.RightUpperLeg.trailOuter.Enabled = true
    player.Character.RightUpperLeg.trailInner.Enabled = true
    player.Character.RightUpperLeg.trailLight.Enabled = true
    player.Character.RightUpperLeg.lightningParticle.Enabled = true

    player.Character.RightUpperArm.trailOuter.Enabled = true
    player.Character.RightUpperArm.trailInner.Enabled = true
    player.Character.RightUpperArm.trailLight.Enabled = true
    player.Character.RightUpperArm.lightningParticle.Enabled = true

    player.Character.RightHand.trailOuter.Enabled = true
    player.Character.RightHand.trailInner.Enabled = true
    player.Character.RightHand.trailLight.Enabled = true
    player.Character.RightHand.lightningParticle.Enabled = true

    player.Character.RightFoot.trailOuter.Enabled = true
    player.Character.RightFoot.trailInner.Enabled = true
    player.Character.RightFoot.trailLight.Enabled = true
    player.Character.RightFoot.lightningParticle.Enabled = true

    player.Character.LeftUpperLeg.trailOuter.Enabled = true
    player.Character.LeftUpperLeg.trailInner.Enabled = true
    player.Character.LeftUpperLeg.trailLight.Enabled = true
    player.Character.LeftUpperLeg.lightningParticle.Enabled = true

    player.Character.LeftUpperArm.trailOuter.Enabled = true
    player.Character.LeftUpperArm.trailInner.Enabled = true
    player.Character.LeftUpperArm.trailLight.Enabled = true
    player.Character.LeftUpperArm.lightningParticle.Enabled = true

    player.Character.LeftHand.trailOuter.Enabled = true
    player.Character.LeftHand.trailInner.Enabled = true
    player.Character.LeftHand.trailLight.Enabled = true
    player.Character.LeftHand.lightningParticle.Enabled = true

    player.Character.LeftFoot.trailOuter.Enabled = true
    player.Character.LeftFoot.trailInner.Enabled = true
    player.Character.LeftFoot.trailLight.Enabled = true
    player.Character.LeftFoot.lightningParticle.Enabled = true

end


Event.OnServerEvent:Connect(running)

PS: i am cloning a model from the workspace and making that my new character

thanks in advance for the help

Answer this question