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

Making a magic attack, but the part isn't even spawning?

Asked by 5 years ago

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

1local event = game.ReplicatedStorage.Pet
2local plr = game.Players.LocalPlayer
3local char = plr.Character or plr:WaitForChild("Character")
4local tool = script.Parent
5 
6tool.Activated:Connect(function()
7    event:FireServer(char.Torso.Position)
8    end)

Server Script

01local event = game.ReplicatedStorage.Pet
02local plr = game.Players.LocalPlayer
03local char = plr.Character or plr:WaitForChild("Character")
04 
05event.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
11end)

Anyone know the problem?

0
you realize you can just do tool.Activated in the server script, right? Reset8449879 204 — 5y
0
no i don't- how does that work? Logophilic 37 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

You did not specify where you want the part to be placed in when created, it should be:

1Instance.new("Part", workspace)

instead of just:

1Instance.new("Part")
0
i used gay.Parent = workspace.Magic Logophilic 37 — 5y
0
Oh, I didn't see it. DbExpress 20 — 5y
0
Is the character R15 or R6, if the player is R15 set "char.Torso.Position" to "char.HumanoidRootPart.Position" DbExpress 20 — 5y
Ad
Log in to vote
0
Answered by
Lunaify 66
5 years ago
Edited 5 years ago

LocalScript

01local ReplicatedStorage = game:GetService("ReplicatedStorage")
02local Magic = ReplicatedStorage:WaitForChild("Magic")
03 
04local Player = game.Players.LocalPlayer
05 
06 
07 
08script.Parent.Activated:Connect(function()
09    Magic:FireServer(Player)
10end)

Script

01local ReplicatedStorage = game:GetService("ReplicatedStorage")
02local Magic = ReplicatedStorage:WaitForChild("Magic")
03 
04 
05 
06Magic.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 = Vector3.new(5,5,5)
16 
17    Part.CFrame = CFrame.new(HMRP.Position + Vector3.new(0,2,0))
18 
19end)

try this for now

0
Didn't work... Logophilic 37 — 5y
0
any errors in the output???? Lunaify 66 — 5y

Answer this question