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

Why does this script work in Solo mode but not in server test mode?

Asked by 9 years ago
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local cam = workspace.CurrentCamera
local char = player.Character
local Torsoz = char:findFirstChild("Torso")
local RA = char:findFirstChild("Right Arm")
local LA = char:findFirstChild("Left Arm")
local RL = char:findFirstChild("Right Leg")
local LL = char:findFirstChild("Left Leg")
local H = char:findFirstChild("Head")
local Hu = char:findFirstChild("Humanoid")
local RS = Torsoz:findFirstChild("Right Shoulder")
local LS = Torsoz:findFirstChild("Left Shoulder")
local RH = Torsoz:findFirstChild("Right Hip")
local LH = Torsoz:findFirstChild("Left Hip")
local N = Torsoz:findFirstChild("Neck")
local NV = Vector3.new(0,0,0)
local FOV = 70
local Shift, Space, Sitting = false,false,false
local GravPoint = 0
local Diving = false
local DivingCooldown = 0
local DivingDir = NV
local DivingCF = CFrame.new(0,0,0)
local DivingBG, DivingBV
local HWallRunning = false
local HWRGravDrop = false
local HWRLastPart
local HWRCooldown = 0
local HWRDir
local VWallRunning = false
local VWRLastPart
local VWRCooldown = 0
local VWRLeft,VWRRight = false,false
local Sliding = false
local SlideCooldown = 0
local Standing = true
local Action = "Standing"
local animplus = true
local animspeed = 0
local animangle = 0.01
local Joint1, Joint2, Joint3, Joint4, Joint5

for i, v in pairs(char:children()) do
if (v.className == "LocalScript" and v.Name == "ParkourSkrip") or v.className == "NumberValue" or v.className == "BoolValue" or v.className == "Model" or v.Name == "Animate" then
v:remove()
end
end

local loadids = {112474909, 112474911, 112474909}

local stamina = 99999
local maxstamina = 999999
local defsprint = 28
local sprint = defsprint  

local pause = Instance.new("BoolValue", char)
pause.Name = "Pause"
pause.Value = false
local flow = Instance.new("NumberValue", char)
flow.Name = "Flow"
flow.Value = 0
local flowcooldown = 0

local m = Instance.new("Model", char)
m.Name = "FlowChainPartz"

local P = Instance.new("Part")
P.Name = "TrailPart"
P.formFactor = "Custom"
P.Size = Vector3.new(0.2,0.2,0.2)
P.Locked = true
P.Anchored = true
P.CanCollide = false
P.TopSurface = 0
P.BottomSurface = 0

script.Name = "ParkourSkrip"

local hue = 0

function HSV(H,S,V)
H = H % 360
local C = V * S
local H2 = H/60
local X = C * (1 - math.abs((H2 %2) -1))
local color = Color3.new(0,0,0)
if H2 <= 0 then
color = Color3.new(C,0,0)
elseif 0 <= H2 and H2 <= 1 then
color = Color3.new(C,X,0)
elseif 1 <= H2 and H2 <= 2 then
color = Color3.new(X,C,0)
elseif 2 <= H2 and H2 <= 3 then
color = Color3.new(0,C,X)
elseif 3 <= H2 and H2 <= 4 then
color = Color3.new(0,X,C)
elseif 4 <= H2 and H2 <= 5 then
color = Color3.new(X,0,C)
elseif 5 <= H2 and H2 <= 6 then
color = Color3.new(C,0,X)
end
local m = V - C
return Color3.new(color.r + m, color.g + m, color.b + m)
end

function GetWeld(weld)
if weld:findFirstChild("XAngle") == nil then
local a = Instance.new("NumberValue", weld)
a.Name = "XAngle"
end
if weld:findFirstChild("YAngle") == nil then
local a = Instance.new("NumberValue", weld)
a.Name = "YAngle"
end
if weld:findFirstChild("ZAngle") == nil then
local a = Instance.new("NumberValue", weld)
a.Name = "ZAngle"
end
return weld.C0.p, Vector3.new(weld.XAngle.Value, weld.YAngle.Value, weld.ZAngle.Value)
end

function SetWeld(weld, i, loops, origpos,origangle, nextpos,nextangle)
if weld:findFirstChild("XAngle") == nil then
local a = Instance.new("NumberValue", weld)
a.Name = "XAngle"
end
if weld:findFirstChild("YAngle") == nil then
local a = Instance.new("NumberValue", weld)
a.Name = "YAngle"
end
if weld:findFirstChild("ZAngle") == nil then
local a = Instance.new("NumberValue", weld)
a.Name = "ZAngle"
end

local tox,toy,toz = 0,0,0
if origangle.x > nextangle.x then
tox = -math.abs(origangle.x - nextangle.x) /loops*i
else
tox = math.abs(origangle.x - nextangle.x) /loops*i
end
if origangle.y > nextangle.y then
toy = -math.abs(origangle.y - nextangle.y) /loops*i
else
toy = math.abs(origangle.y - nextangle.y) /loops*i
end
if origangle.z > nextangle.z then
toz = -math.abs(origangle.z - nextangle.z) /loops*i
else
toz = math.abs(origangle.z - nextangle.z) /loops*i
end

local tox2,toy2,toz2 = 0,0,0
if origpos.x > nextpos.x then
tox2 = -math.abs(origpos.x - nextpos.x) /loops*i
else
tox2 = math.abs(origpos.x - nextpos.x) /loops*i
end
if origpos.y > nextpos.y then
toy2 = -math.abs(origpos.y - nextpos.y) /loops*i
else
toy2 = math.abs(origpos.y - nextpos.y) /loops*i
end
if origpos.z > nextpos.z then
toz2 = -math.abs(origpos.z - nextpos.z) /loops*i
else
toz2 = math.abs(origpos.z - nextpos.z) /loops*i
end

weld.XAngle.Value = origangle.x + tox
weld.YAngle.Value = origangle.y + toy
weld.ZAngle.Value = origangle.z + toz
weld.C0 = CFrame.new(origpos.x + tox2,origpos.y + toy2,origpos.z + toz2) * CFrame.Angles(origangle.x + tox,origangle.y + toy,origangle.z + toz)
end

function LoadTextures()
local pls = game:service("ContentProvider")
for i, v in pairs(loadids) do
pls:Preload("http://www.roblox.com/asset/?id="..v)
1
Like Redbullusa said, just giving us the code doesn't make for a useful question. Please include the Output, or say that you don't have any and where you think the error is occuring. adark 5487 — 9y

1 answer

Log in to vote
2
Answered by
Redbullusa 1580 Moderation Voter
9 years ago

Have you checked the Output yet? Maybe the variables keep returning nil, because the player hasn't loaded in the server yet. Perhaps use a :WaitForChild() method for the variable for any object (the player) or repeat wait(.5) until game.Players.LocalPlayer ~= nil in line 1.

0
Thanks it worked! 789zaya 0 — 9y
Ad

Answer this question