I've got a script that I took from an open source game to play around with, but got frustrated when I couldn't make the script work in FilteringEnabled. It was originally a local script, but since I know that local scripts cannot create instances for anyone besides the player who created it, I changed it to a server sided script and changed Local Player = game.Players.LocalPlayer, to, local Player = script.Parent.Parent.Parent.
The script is inside of a tool that is inside of the StarterPack.
What exactly about it is broken? Well.. everything really. All the player can do with the tool here is equip it, and the idle animation doesn't even play. I tested this outside of FE mode, and it worked perfectly, so I think that this is an FE issue.
Should I maybe try using RemoteEvents for it? If so, where should I use them at?
Thanks for your time.
script: (it's a combat script that plays animations and does damage to mimic melee combat)
wait(0.5)
local play = script.Parent.Parent.Parent
local char = play.Character
local hum = char.Humanoid
local Tool = script.Parent
local mouse = play:GetMouse()
hit = Tool.Handle.Hit
local anim = nil
local jump = false
local tim = 0
local equipped = false
local damage = play.Levelss.CombatDamage.Value
local attack = ""
local throwing = true
local alternate = false
local idle = hum:LoadAnimation(script.Idle)
local p = true
function weldTogether(x,y)
local W = Instance.new("Weld")
W.Part0 = x
W.Part1 = y
local CJ = CFrame.new(x.Position)
local C0 = x.CFrame:inverse()*CJ
local C1 = y.CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = x
end
fist1 = Instance.new("Part")
fist1.FormFactor = "Custom"
fist1.Name = "Point"
fist1.Size = Vector3.new(1,2,1)
fist1.Transparency = 1
fist1.CanCollide = false
fist1.CFrame = char["RightHand"].CFrame + (char["RightHand"].CFrame* CFrame.Angles(math.rad(-90),0,0)).lookVector
fist2 = fist1:clone()
fist2.CFrame = char["LeftHand"].CFrame + (char["LeftHand"].CFrame * CFrame.Angles(math.rad(-90),0,0)).lookVector
foot1 = fist1:clone()
foot1.CFrame = char["RightLowerLeg"].CFrame + (char["RightLowerLeg"].CFrame * CFrame.Angles(math.rad(-90),0,0)).lookVector
weldTogether(fist1, char["RightHand"])
weldTogether(fist2, char["LeftHand"])
weldTogether(foot1, char["RightLowerLeg"])
fist1.Parent = Tool
fist2.Parent = Tool
foot1.Parent = Tool
fist1.Touched:connect(function(hit)
touchy(fist1, "RightPunch", hit)
end)
fist2.Touched:connect(function(hit)
touchy(fist2, "LeftPunch", hit)
end)
foot1.Touched:connect(function(hit)
touchy(foot1, "AirKick", hit)
end)
function swoosh()
Tool.Handle.Swoosh.Pitch = math.random(10,14)/10
Tool.Handle.Swoosh:Play()
end
local animTrack = nil
function animate()
if animTrack ~= nil then
animTrack:Stop()
end
attack = ""
if jump == true then -- in the air
if (game.Workspace.DistributedGameTime - tim) < 0.15 then -- uppercut
attack = "RightPunch" -- attacking part
swoosh()
animTrack = hum:LoadAnimation(script.Uppercut)
animTrack:Play()
wait(0.3)
else -- kick
attack = "AirKick"
swoosh()
animTrack = hum:LoadAnimation(script.AirKick)
animTrack:Play()
wait(0.3)
end
else -- not in the air
if alternate == false then -- right punch
alternate = true
attack = "RightPunch"
swoosh()
animTrack = hum:LoadAnimation(script.RightPunch)
animTrack:Play()
wait(0.2)
else -- left punch
alternate = false
attack = "LeftPunch"
swoosh()
animTrack = hum:LoadAnimation(script.LeftPunch)
animTrack:Play()
wait(0.2)
end
end
end
function attacker(humanoid)
--determine animation
hit.Pitch = math.random(10,14)/10
local ldamage = damage
if humanoid:findFirstChild("Effects") then
else
hit:Play()
end
if humanoid:FindFirstChild("Effects") then
if humanoid.Effects:FindFirstChild("Metal") then
ldamage = 3.25
end
end
if humanoid:findFirstChild("DamageSystem") and not humanoid.Parent:findFirstChild("IsAShip") then -- do damage
script.Parent.Damage:FireServer(humanoid, play, ldamage)
elseif not humanoid.Parent:findFirstChild("IsAShip") then
humanoid:TakeDamage(ldamage)
end
end
en = true
mouse.Button1Down:connect(function() -- click
if Tool.Parent == char and play.Levelss.Stamina.Value >=5 then
if not en then return end
if char:FindFirstChild("ForceField") then return end
-- put exp change here and stuff
play.Levelss.Stamina.Value = play.Levelss.Stamina.Value - 5
en = false
--throwing = true
throwing = true
animate()
--[[
infront = root.Position + (root.CFrame.lookVector * 2) -- 2 studs infront of the player
z = game.Players:GetChildren()
for i= 1, #z do
if z[i] ~= play and z[i].Character ~= nil and z[i].Character:findFirstChild("Torso") then
enemy = z[i].Character
if (root.Position - enemy.HumanoidRootPart.Position).magnitude < 3 then -- in range of an attack
attacker(enemy.Humanoid)
end
end
end ]]
throwing = false
wait(0.1)
en = true
end
end)
function knockback(humanoid, point)
kp = Instance.new("Part")
kp.Transparency = 1
kp.Name = "PuncKnockback"
kp.FormFactor = "Custom"
bv = Instance.new("BodyVelocity")
bv.maxForce = Vector3.new(1e8,1e7,1e8)
bv.velocity = point.Velocity + ((point.CFrame * CFrame.Angles(math.rad(-90),0,0)).lookVector * 4)
print(point.Velocity)
bv.Parent = kp
kp.Size = Vector3.new(0,0,0)
kp.CFrame = humanoid.Parent.Torso.CFrame
weldTogether(kp, humanoid.Parent.Torso)
kp.Parent = humanoid.Parent.Torso
game.Debris:AddItem(kp, 0.1)
end
function touchy(point, part, hit)
if not hit then return end
if not throwing then return end
if not p then return end
if part ~= attack then return end
p = false
humanoid = nil
if hit.Parent:findFirstChild("Humanoid") then
humanoid = hit.Parent.Humanoid
end
if hit.Parent.Parent:findFirstChild("Humanoid") then
humanoid = hit.Parent.Parent.Humanoid
end
if humanoid and not humanoid.Parent:findFirstChild("IsAShip") then
if humanoid.Parent:findFirstChild("ForceField") then p = true return end
attacker(humanoid)
if humanoid.Parent:findFirstChild("UpperTorso") then
knockback(humanoid, point)
end
end
wait(0.2)
p = true
end
crzk = false
function OnEquipped(mouse) -- select tool
idle:Play()
Tool.Handle.Crack:play()
equipped = true
end
function UnEquipped(mouse) -- deselect tool
idle:Stop()
unequipped = false
end
hum.Jumping:connect(function() -- jumped
jump = true
tim = game.Workspace.DistributedGameTime
end)
hum.Running:connect(function() -- stopped jumping
jump = false
end)
hum.Climbing:connect(function() -- stopped jumping
jump = false
end)
Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(UnEquipped)

3 comments
You can't get the mouse of the player inside a server script.
So should I try and break the script up into two separate scripts maybe? I've got no idea how to get around this and make it work in FE ;-;
By separate I mean Local and Server-Sided scripts