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

Is it possible to link a script with a localscript?

Asked by 8 years ago

Hello,

My question is is it possible to link a script with a localscript because i have a code in a script and a localscript but i need to link them to get it to work can someone help me with this

Script:
game.Players.PlayerAdded:connect(function(player) 
    player.CharacterAdded:connect(function(char) 
        if char then
            local torso = char:FindFirstChild'Torso'
            local speed2 = Instance.new("ParticleEmitter", torso)
        end
    end)
end)

Localscript:

local plr = game.Players.LocalPlayer

local char = plr.Character

local hum = char.Humanoid

local color1 = Color3.new(255,82,2)

local color2 = Color3.new(255,72,0)

local speed2 = Instance.new("ParticleEmitter", torso) --- This needs to connect with the script

hum.Running:connect(function(speed)
    if speed > 30 then

speed2.Texture = "http://www.roblox.com/asset/?id=281983189"
speed2.Size= NumberSequence.new(5)
speed2.LightEmission = 0.62
speed2.Color = ColorSequence.new(color1,color2)
speed2.Lifetime = NumberRange.new(0,5)

    else

speed2.Texture = "http://www.roblox.com/asset/?id=281983189"
speed2.Size= NumberSequence.new(0)
speed2.LightEmission = 0
speed2.Color = ColorSequence.new(color1,color2)
speed2.Lifetime = NumberRange.new(1)
    end
end)

Answer this question