Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

OnServerEvent not working for Transformation?

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.

    Player = game.Players.LocalPlayer
Transforming = false
Transformed = false

  

 game.Workspace.Powerup.OnServerEvent:Connect(function(Player, Debounce)

if Transformed == true then

Player.Character.Humanoid.MaxHealth = 100

Transformed = false

else

local Character = Player.Character or Player.CharacterAdded:wait()

Transforming = true

local Aura = Instance.new("Part", Player.Character.UpperTorso)

Aura.Transparency = 1

Aura.Anchored = true

local Aurafire = Instance.new("ParticleEmitter", Aura)

Aurafire.Texture = ("rbxassetid://242102147")

Aurafire.Color = BrickColor.new("Black")

wait(5)

Player.Character.Humanoid.MaxHealth = 200

Transforming = false

Transformed = true

end

end)

4 comments

0

is this from the client and is Powerup a remote event

0

Powerup is a remote event

0

And what do you mean by the client? Sorry i'm new to the coding game.

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.

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.