When I was testing a transformation code (Using Z to transform with remote events & Toolbox Localscripts, with an execution script in the workspace) I came across a large issue. When I used “OnServerEvent”, it said “OnServerEvent” is not a valid member of script. When testing this with a fireball using similar if not the exact same script, minus casting time and cooldown, it worked.
01 | Player = game.Players.LocalPlayer |
02 | Transforming = false |
03 | Transformed = false |
04 |
05 | |
06 |
07 | game.Workspace.Powerup.OnServerEvent:Connect( function (Player, Debounce) |
08 |
09 | if Transformed = = true then |
10 |
11 | Player.Character.Humanoid.MaxHealth = 100 |
12 |
13 | Transformed = false |
14 |
15 | else |
16 |
17 | local Character = Player.Character or Player.CharacterAdded:wait() |
18 |
19 | Transforming = true |
20 |
21 | local Aura = Instance.new( "Part" , Player.Character.UpperTorso) |
22 |
23 | Aura.Transparency = 1 |
24 |
25 | Aura.Anchored = true |
26 |
27 | local Aurafire = Instance.new( "ParticleEmitter" , Aura) |
28 |
29 | Aurafire.Texture = ( "rbxassetid://242102147" ) |
30 |
31 | Aurafire.Color = BrickColor.new( "Black" ) |
32 |
33 | wait( 5 ) |
34 |
35 | Player.Character.Humanoid.MaxHealth = 200 |
36 |
37 | Transforming = false |
38 |
39 | Transformed = true |
40 |
41 | end |
42 |
43 | end ) |
You need tp put local char = Player.Character After your first line otherwise it wont know where to find the added character