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

Why Sword Work For Studio But Not Game?

Asked by 9 years ago

Why does this work for Studio but now the game?

msg:lower():sub(1,6) == "sword " then
local plrz = GetPlr(plr, msg:lower():sub(7))
for i, v in pairs(plrz) do
coroutine.resume(coroutine.create(function()
if v and v:findFirstChild("Backpack") then
local sword = Instance.new("Tool", v.Backpack) sword.Name = "Sword"  sword.TextureId = "rbxasset://Textures/Sword128.png"
sword.GripForward = Vector3.new(-1,0,0)
sword.GripPos = Vector3.new(0,0,-1.5)
sword.GripRight = Vector3.new(0,1,0)
sword.GripUp = Vector3.new(0,0,1)
local handle = Instance.new("Part", sword) handle.Name = "Handle" handle.FormFactor = "Plate" handle.Size = Vector3.new(1,.8,4) handle.TopSurface = 0 handle.BottomSurface = 0
local msh = Instance.new("SpecialMesh", handle) msh.MeshId = "rbxasset://fonts/sword.mesh" msh.TextureId = "rbxasset://textures/SwordTexture.png"
local cl = script.LocalScriptBase:Clone() cl.Parent = sword cl.Code.Value = [[
repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild("Humanoid")
local Damage = 15
local SlashSound = Instance.new("Sound", script.Parent.Handle)
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Volume = 1
local LungeSound = Instance.new("Sound", script.Parent.Handle)
LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
LungeSound.Volume = 1
local UnsheathSound = Instance.new("Sound", script.Parent.Handle)
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Volume = 1
local last = 0
script.Parent.Handle.Touched:connect(function(hit)
if hit and hit.Parent and hit.Parent:findFirstChild("Humanoid") and game.Players:findFirstChild(hit.Parent.Name) and game.Players.LocalPlayer.Character.Humanoid.Health > 0 and hit.Parent.Humanoid ~= game.Players.LocalPlayer.Character.Humanoid then
local tag = Instance.new("ObjectValue", hit.Parent.Humanoid) tag.Value = plr1 tag.Name = "creator" game:service("Debris"):AddItem(tag, 3)
hit.Parent.Humanoid:TakeDamage(Damage)
end
end)
script.Parent.Activated:connect(function()
if not script.Parent.Enabled or game.Players.LocalPlayer.Character.Humanoid.Health <= 0 then return end
script.Parent.Enabled = false
local tick = game:service("RunService").Stepped:wait()
if tick - last <= .2 then
LungeSound:play()
local lunge = Instance.new("StringValue", script.Parent) lunge.Name = "toolanim" lunge.Value = "Lunge"
local frc = Instance.new("BodyVelocity", game.Players.LocalPlayer.Character.Torso) frc.Name = "SwordForce" frc.velocity = Vector3.new(0,10,0)
wait(.2)
script.Parent.GripForward = Vector3.new(0,0,1)
script.Parent.GripRight = Vector3.new(0,-1,0)
script.Parent.GripUp = Vector3.new(-1,0,0)
wait(.3)
frc:Destroy() wait(.5)
script.Parent.GripForward = Vector3.new(-1,0,0)
script.Parent.GripRight = Vector3.new(0,1,0)
script.Parent.GripUp = Vector3.new(0,0,1)
else
SlashSound:play()
local slash = Instance.new("StringValue", script.Parent) slash.Name = "toolanim" slash.Value = "Slash"
end
last = tick
script.Parent.Enabled = true
end)
script.Parent.Equipped:connect(function(mouse)
for i,v in pairs(game.Players.LocalPlayer.Character.Torso:children()) do if v.Name == "SwordForce" then v:Destroy() end end
UnsheathSound:play()
script.Parent.Enabled = true
if not mouse then return end
mouse.Icon = "http://www.roblox.com/asset/?id=103593352"
end)]] cl.Disabled = false 
end
end))
0
I have seen this code before, it is used in Kohltastrophe's Admin, you did not create it. TheeDeathCaster 2368 — 9y

1 answer

Log in to vote
0
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
9 years ago

Local Scripts no longer have the LoadString functionality as of;

4 September 2014


Client-side loadstring() no longer works; LocalScripts with LinkedSource property set also no longer work.

This is stated in the Roblox Wiki Changelog

The LoadString function has been removed from LocalScripts, due to exploitation of admin commands local scripts that previously allowed loadstring to work. Due to the exploitation, Roblox administrators heightened the security of games, by setting to false by default LoadStringEnabled property located in ServerScriptService, and disabling of LoadString in LocalScripts.

What you can try, to fix the admin command is by copying and pasting the code for the sword script into another local script, and placing that script into the sword as it is created.

In the future, please recognize this is ScriptingHelpers, we do not find errors for you, we do not make scripts for you, we help debug and solve issues for you. We also do not accept copy and pasted code as well. Thank you.

Ad

Answer this question