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

I cant seem to make the characters head rotate for server too, why? (FE)

Asked by 5 years ago
Edited 5 years ago

I am nearly there but ugh(i got the tick()bit from another tutorial)

Server

if script.Parent == workspace then script.Parent = game.StarterPlayer.StarterCharacterScripts; 
    print("Please put the 'HeadMovementServer' script into StarterPlayer.StarterCharacterScripts."); 
end;

if script.Parent == game.StarterPlayer.StarterCharacterScripts then return 
end;

local tweenService = game:GetService("TweenService");
local remote = script:FindFirstChild("Remote") ~= nil and script.Remote or Instance.new("RemoteEvent", script);

remote.Name = "Remote";

local debounce = tick();

remote.OnServerEvent:connect(function(player, mouseDirection, neck)
    if game.Players.LocalPlayer ~= nil then return 
    end;

    if tick()-debounce <= 0.1 then return 
    end;

    debounce = tick();
    tweenService:Create(neck, TweenInfo.new(0.099), {C1=(CFrame.new(Vector3.new(-0, -0.500000119, -0.000272244215)) * CFrame.Angles(mouseDirection, 0, 0))}):Play();
end)

Local

if script.Parent == workspace then script.Parent = game.StarterPlayer.StarterCharacterScripts; 
    print("Please put the 'HeadMovementServer' script into StarterPlayer.StarterCharacterScripts."); 
end;

if script.Parent == game.StarterPlayer.StarterCharacterScripts then return 
end;

local tweenService = game:GetService("TweenService");
local remote = script:FindFirstChild("Remote") ~= nil and script.Remote or Instance.new("RemoteEvent", script);

remote.Name = "Remote";

local debounce = tick();

remote.OnServerEvent:connect(function(player, mouseDirection, neck)
    if game.Players.LocalPlayer ~= nil then return 
    end;

    if tick()-debounce <= 0.1 then return 
    end;

    debounce = tick();
    tweenService:Create(neck, TweenInfo.new(0.099), {C1=(CFrame.new(Vector3.new(-0, -0.500000119, -0.000272244215)) * CFrame.Angles(mouseDirection, 0, 0))}):Play();
end)
0
LocalPlayer will always be nil on the server. so line 16 of the server script should use the player parameter instead Gey4Jesus69 2705 — 5y
0
ok, i will try aleandroblingo -35 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

I changed it here but i cant implement it to move the head in server

if script.Parent == workspace then script.Parent = game.StarterPlayer.StarterCharacterScripts; 
    print("Please put the 'HeadMovementServer' script into StarterPlayer.StarterCharacterScripts."); 
end;

if script.Parent == game.StarterPlayer.StarterCharacterScripts then return 
end;

local tweenService = game:GetService("TweenService");
local remote = script:FindFirstChild("Remote") ~= nil and script.Remote or Instance.new("RemoteEvent", script);

remote.Name = "Remote";

local debounce = tick();

remote.OnServerEvent:connect(function(player, HdPos, Neck)--HdPos--mouseDirection

    warn(player.name)
    warn(HdPos)

    if (player) ~= nil then return 
    end;

end)
Ad

Answer this question