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

Works in LocalScript, doesn't work in regular script, how to make a regular script of this?

How do I convert this LocalScript to have the same effect as a Script?

script.Parent.Equipped:Connect(function(Mouse)
	Mouse.Button1Down:Connect(function()
		local dust = Instance.new('Smoke')
		dust.Parent = script.Parent.Brush
		dust.Color = Color3.fromRGB(199, 172, 120)
		dust.Size = 0.5
		dust.Opacity = 0.5
		dust.RiseVelocity = 0.5
		wait(2)
		dust:Destroy()
	end)
end)

1 answer

Insert a RemoteEvent in your ReplicatedStorage. Insert a Script in your ReplicatedStorage.

Script:

local remoteevent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

local function onserverevent (player)
	local dust = Instance.new('Smoke')
	dust.Parent = script.Parent.Brush
	dust.Color = Color3.fromRGB(199, 172, 120)
	dust.Size = 0.5
	dust.Opacity = 0.5
	dust.RiseVelocity = 0.5
	wait(2)
	dust:Destroy()
end

remoteevent.OnServerEvent:Connect(onserverevent)

Local Script:

local remoteevent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

script.Parent.Equipped:Connect(function(Mouse)
    Mouse.Button1Down:Connect(function()
        remoteevent:FireServer()
    end)
end)

You can place the remote event and script inside a tool, but not inside a StarterGUI. If you do change it, don't forget to change the variables for the remoteevent.

1 comment

0

For the regular script you forgot about the fact that you need to click in order for it to function. I'm still having trouble fixing this. Do you know how to accomplish this?

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