Basically I'm working on making a magic attack, using FE. (I'm not experienced with FE so it is supposed to be super basic) The part that I am going to use for it isn't even spawning.
Local Script
1 | local event = game.ReplicatedStorage.Pet |
2 | local plr = game.Players.LocalPlayer |
3 | local char = plr.Character or plr:WaitForChild( "Character" ) |
4 | local tool = script.Parent |
5 |
6 | tool.Activated:Connect( function () |
7 | event:FireServer(char.Torso.Position) |
8 | end ) |
Server Script
01 | local event = game.ReplicatedStorage.Pet |
02 | local plr = game.Players.LocalPlayer |
03 | local char = plr.Character or plr:WaitForChild( "Character" ) |
04 |
05 | event.OnServerEvent:Connect( function (plr,position) |
06 | local gay = Instance.new( "Part" ) |
07 | gay.Shape = "Ball" |
08 | gay.BrickColor = BrickColor.new( "Red" ) |
09 | gay.Position = position |
10 | gay.Parent = workspace.Magic |
11 | end ) |
Anyone know the problem?
You did not specify where you want the part to be placed in when created, it should be:
1 | Instance.new( "Part" , workspace) |
instead of just:
1 | Instance.new( "Part" ) |
LocalScript
01 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | local Magic = ReplicatedStorage:WaitForChild( "Magic" ) |
03 |
04 | local Player = game.Players.LocalPlayer |
05 |
06 |
07 |
08 | script.Parent.Activated:Connect( function () |
09 | Magic:FireServer(Player) |
10 | end ) |
Script
01 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | local Magic = ReplicatedStorage:WaitForChild( "Magic" ) |
03 |
04 |
05 |
06 | Magic.OnServerEvent:Connect( function (player,Player) |
07 | local Character = Player.Character |
08 | print (Character.Name) |
09 |
10 | local HMRP = Character:WaitForChild( "HumanoidRootPart" ) |
11 |
12 | local Part = Instance.new( "Part" ) |
13 | Part.Parent = workspace |
14 | Part.Shape = "Ball" |
15 | Part.Size = Vector 3. new( 5 , 5 , 5 ) |
16 |
17 | Part.CFrame = CFrame.new(HMRP.Position + Vector 3. new( 0 , 2 , 0 )) |
18 |
19 | end ) |
try this for now