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

OnServerEvent not working for Transformation?

Asked by 6 years ago

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
02Transforming = false
03Transformed = false
04 
05   
06 
07 game.Workspace.Powerup.OnServerEvent:Connect(function(Player, Debounce)
08 
09if Transformed == true then
10 
11Player.Character.Humanoid.MaxHealth = 100
12 
13Transformed = false
14 
15else
16 
17local Character = Player.Character or Player.CharacterAdded:wait()
18 
19Transforming = true
20 
21local Aura = Instance.new("Part", Player.Character.UpperTorso)
22 
23Aura.Transparency = 1
24 
25Aura.Anchored = true
26 
27local Aurafire = Instance.new("ParticleEmitter", Aura)
28 
29Aurafire.Texture = ("rbxassetid://242102147")
30 
31Aurafire.Color = BrickColor.new("Black")
32 
33wait(5)
34 
35Player.Character.Humanoid.MaxHealth = 200
36 
37Transforming = false
38 
39Transformed = true
40 
41end
42 
43end)
0
is this from the client and is Powerup a remote event EXpodo1234ALT 18 — 6y
0
Powerup is a remote event itchymoonfire 179 — 6y
0
And what do you mean by the client? Sorry i'm new to the coding game. itchymoonfire 179 — 6y
0
Just looked it up, and I think it's being run on the server, because the server is producing these object (Particles and stuff) for the client who fired the event. If it were just on the client I think it would only be visible to the Client. itchymoonfire 179 — 6y

1 answer

Log in to vote
0
Answered by 4 years ago

You need tp put local char = Player.Character After your first line otherwise it wont know where to find the added character

Ad

Answer this question