So i was making lightsaber that activates with GUI button using Transparency on morphed parts, but the problem that it is local script and i know that FE has to be activated with remote events, but is it works on local player model in workspace? Do i have to make main script and remote events for lightsaber activation?
Here's the script so you can see how it works.
local player = game.Players.LocalPlayer local plr = player.Character.Name local toggled = false local button = script.Parent local function onButtonActivated() game.Workspace:FindFirstChild(plr).LightSaberModel1.Blade.Transparency = 0.3 game.Workspace:FindFirstChild(plr).LightSaberModel2.Blade.Transparency = 1 end button.Activated:Connect(onButtonActivated)
there is no any errors in script, and it works perfectly and fine so idk if FE breaks it.
Firstly, put your ClientScript (LocalScript) on your tool. secondly put a new RemoteEvent and a new ServerScript (Script) in this tool. Now I start from the principle of you use a ScreenGui with on that a TextButton and a Tool.
We go to found the player on the ClientScript (LocalScript) like that
local Player = game:GetService('Players') -- This is the instance in the Players folder on the explorer
it's just a link. You can view this instance when you play on studio and you open the "Players" service on the explorer like that
Now you have see on this instance we've Backpack and PlayerGui. In the PlayerGui you can found your ScreenGui like that
local Player = game:GetService('Players') local PlayerGui = Player:WaitForChild('PlayerGui') local YOUR_SCREENGUI = PlayerGui:WaitForChild('YOUR_SCREENGUI_NAME_HERE')
What's WaitForChild? Click here to see the Dev page
Now we've access to your UI! Congrats! Now your script look like this!
local Tool = script.Parent local Remote = Tool.RemoteEvent local Player = game:GetService('Players') local PlayerGui = Player:WaitForChild('PlayerGui') local YOUR_SCREENGUI = PlayerGui:WaitForChild('YOUR_SCREENGUI_NAME_HERE') YOUR_SCREENGUI.TextButton.Activated:Connect(function() -- Directly execute this function! Remote:FireServer() end)
Now go to your ServerScript (Script) and write thats!
local Tool = script.Parent local Remote = Tool.RemoteEvent local Activ = false Remote.OnServerEvent:Connect(function() if not Activ then Activ = true Tool.Blade.Transparency = 0.3 Tool.Blade.Transparency = 1 end end)
Here's how to make an FE tool. If you have any questions ask them below!