Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

when i try to make the tool FE, it doesn't work & doesn't tell me whats wrong with it. help?

--localscript
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local event = script.Parent:WaitForChild("RemoteEvent")
Mouse.Button1Down:connect(function()

event.OnClientEvent:connect(function(player, arguments)
if arguments == true then

elseif arguments == false then
	if Mouse.Target ~= nil then
		Mouse.Target.Parent:FindFirstChild("Humanoid")
		if Mouse.Target.Parent.Humanoid == nil then
			print("you failed...")
		end
		spawn(function()
		if Mouse.Target.Parent.Humanoid ~= nil then
			local Foreign = Mouse.Target.Parent
			local Character = Player.Character
			local Trangle = Foreign.Torso:FindFirstChild("Attachment")
			if Trangle == nil then
				local Link = Instance.new ("Attachment")
				Link.Parent = Foreign.Torso
				Character.Arm1.ControlStone.Beam.Attachment1 = Foreign.Torso.Attachment
				Character.Arm1.ControlStone.Attachment.Shine.Enabled = true
				local anim = Character.Humanoid:LoadAnimation(script:FindFirstChild("Animation"))
				anim:Play()
				wait(1)
	 
	local gradual = 140 -- Smoothness of transition. May be performance hungry but idk.
	 
local waittime = 0.006 -- Speed of transition. Slower at high values and faster at lower values.
	 
	for i = 1, gradual do
	  wait(waittime)
	 local numseq = {NumberSequenceKeypoint.new(0,i/gradual),NumberSequenceKeypoint.new(1,i/gradual)}
	local NS = NumberSequence.new(numseq)
	 
	   Character.Arm1.ControlStone.Beam.Transparency = NS
	end
event:FireServer()
		end
		end
		end)
			
		end
end
end)
end)

--script
script.Parent.RemoteEvent.OnServerEvent:connect(function(player, arguments)
		local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
		if Mouse.Target ~= nil then
		Mouse.Target.Parent:FindFirstChild("Humanoid")
		if Mouse.Target.Parent.Humanoid == nil then
			print("you failed...")
		end
		spawn(function()
		if Mouse.Target.Parent.Humanoid ~= nil then
			local Foreign = Mouse.Target.Parent
			local Character = Player.Character
			local Trangle = Foreign.Torso:FindFirstChild("Attachment")
			if Trangle == nil then
				local Link = Instance.new ("Attachment")
				Link.Parent = Foreign.Torso
				Character.Arm1.ControlStone.Beam.Attachment1 = Foreign.Torso.Attachment
				Character.Arm1.ControlStone.Attachment.Shine.Enabled = true
				local anim = Character.Humanoid:LoadAnimation(script:FindFirstChild("Animation"))
				anim:Play()
				wait(1)
	 
	local gradual = 140 -- Smoothness of transition. May be performance hungry but idk.
	 
local waittime = 0.006 -- Speed of transition. Slower at high values and faster at lower values.
	 
	for i = 1, gradual do
	  wait(waittime)
	 local numseq = {NumberSequenceKeypoint.new(0,i/gradual),NumberSequenceKeypoint.new(1,i/gradual)}
	local NS = NumberSequence.new(numseq)
	 
	   Character.Arm1.ControlStone.Beam.Transparency = NS
	end

		end
		end
		end)
			
		end
end)

i cant solve what i'm doing wrong so if theres anyone out there that can help me or give me something that would solve this please send it. it doesnt even tell me when I press F9

3 comments

0

Hey hop in the chat I might have your solution.

0

this chat?

0

Seems I'm having the same problem with my rocket launcher. Although looking at the code, you can't get a local player from your server script as it can only be done in a local script. This could be the cause?

1 answer

✓ Accepted answer

You are mixing up client/server sided elements. Here is my attempt in fixing your code:

--localscript
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")

Mouse.Button1Down:connect(function()
    if Mouse.Target ~= nil then
        Mouse.Target.Parent:FindFirstChild("Humanoid")
        if Mouse.Target.Parent.Humanoid == nil then
            print("you failed...")
        end
        spawn(function()
        if Mouse.Target.Parent.Humanoid ~= nil then
            local Trangle = Foreign.Torso:FindFirstChild("Attachment")
            if Trangle == nil then
		 local Foreign = Mouse.Target.Parent
              	RemoteEvent:FireServer(Foreign)
        end
        end
        end)

        end
end)

--script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = Instance.new("RemoteEvent", ReplicatedStorage)
RemoteEvent.Name = "RemoteEvent"
 
local function RemoteFired(player,Foreign)
	local Character = player.Character
	local Link = Instance.new ("Attachment")
         Link.Parent = Foreign.Torso
         Character.Arm1.ControlStone.Beam.Attachment1 = Foreign.Torso.Attachment
         Character.Arm1.ControlStone.Attachment.Shine.Enabled = true
         local anim = Character.Humanoid:LoadAnimation(script:FindFirstChild("Animation"))
         anim:Play()
         wait(1)

    local gradual = 140 -- Smoothness of transition. May be performance hungry but idk.

local waittime = 0.006 -- Speed of transition. Slower at high values and faster at lower values.

    for i = 1, gradual do
      wait(waittime)
     local numseq = {NumberSequenceKeypoint.new(0,i/gradual),NumberSequenceKeypoint.new(1,i/gradual)}
    local NS = NumberSequence.new(numseq)

       Character.Arm1.ControlStone.Beam.Transparency = NS
end
RemoteEvent.OnServerEvent:Connect(RemoteFired)

Let me know if there is some issues haven't tested yet! Put the script into ServerScriptService. Put the localscript into ReplicatedFirst or wherever as long as it will be executed there.

1 comment

0

No, not in ReplicatedFirst. It's the first thing to be replicated to the client, and you'd have to put so many waitforchild's. PlayerGui, Backpack, or PlayerScripts is an ideal place.

This discussion is preserved as it was. New answers, comments, and votes are closed.